slothy: init at 0.2.0 (#518986)

This commit is contained in:
Vincent Laporte
2026-05-28 10:08:58 +00:00
committed by GitHub
6 changed files with 132 additions and 1 deletions
+6
View File
@@ -18265,6 +18265,12 @@
githubId = 16974598;
name = "Mike Playle";
};
mkannwischer = {
email = "matthias@kannwischer.eu";
github = "mkannwischer";
githubId = 3984960;
name = "Matthias Kannwischer";
};
mkez = {
email = "matias+nix@zwinger.fi";
github = "mk3z";
+2
View File
@@ -137,6 +137,8 @@ stdenv.mkDerivation (finalAttrs: {
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
(lib.cmakeBool "CMAKE_MACOSX_RPATH" false)
(lib.cmakeFeature "CMAKE_INSTALL_NAME_DIR" "${placeholder "out"}/lib")
(lib.cmakeBool "CMAKE_BUILD_WITH_INSTALL_NAME_DIR" true)
];
strictDeps = true;
+8
View File
@@ -0,0 +1,8 @@
{ python3Packages }:
(python3Packages.toPythonApplication python3Packages.slothy).overrideAttrs (old: {
__structuredAttrs = true;
meta = old.meta // {
mainProgram = "slothy-cli";
};
})
@@ -0,0 +1,45 @@
{
lib,
buildPythonPackage,
lndir,
or-tools,
immutabledict,
numpy,
pandas,
protobuf,
}:
buildPythonPackage {
pname = "ortools";
inherit (or-tools) version;
format = "other";
src = or-tools.python;
dontBuild = true;
nativeBuildInputs = [ lndir ];
installPhase = ''
runHook preInstall
mkdir -p $out
lndir -silent $src $out
runHook postInstall
'';
propagatedBuildInputs = [
immutabledict
numpy
pandas
protobuf
];
pythonImportsCheck = [
"ortools"
"ortools.sat.python.cp_model"
];
meta = or-tools.meta // {
description = "Python bindings for Google's or-tools";
};
}
@@ -0,0 +1,66 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
gcc,
llvm,
ortools,
sympy,
unicorn,
}:
buildPythonPackage rec {
pname = "slothy";
version = "0.2.0";
pyproject = true;
src = fetchFromGitHub {
owner = "slothy-optimizer";
repo = "slothy";
tag = version;
hash = "sha256-1seD/wqAyEcv5HJFO8j53ARd64fddGropA6xk0dq2yk=";
};
build-system = [ setuptools ];
dependencies = [
ortools
sympy
unicorn
];
# slothy shells out to `gcc` and the llvm binutils at runtime; extend
# PATH at import time so the library works in a plain withPackages env.
postPatch = ''
substituteInPlace slothy/__init__.py \
--replace-fail 'from slothy.core.slothy import Slothy' \
'import os
os.environ["PATH"] = "${
lib.makeBinPath [
gcc
llvm
]
}" + os.pathsep + os.environ.get("PATH", "")
from slothy.core.slothy import Slothy'
'';
pythonRelaxDeps = true;
pythonImportsCheck = [ "slothy" ];
installCheckPhase = ''
runHook preInstallCheck
python3 test.py --silent --tests aarch64_simple0_a55
runHook postInstallCheck
'';
meta = {
description = "Assembly superoptimization via constraint solving";
homepage = "https://slothy-optimizer.github.io/slothy";
changelog = "https://github.com/slothy-optimizer/slothy/releases/tag/${version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ mkannwischer ];
platforms = lib.platforms.linux ++ lib.platforms.darwin;
};
}
+5 -1
View File
@@ -12040,7 +12040,9 @@ self: super: with self; {
ormsgpack = callPackage ../development/python-modules/ormsgpack { };
ortools = (toPythonModule (pkgs.or-tools.override { python3 = self.python; })).python;
ortools = callPackage ../development/python-modules/ortools {
or-tools = pkgs.or-tools.override { python3 = self.python; };
};
oru = callPackage ../development/python-modules/oru { };
@@ -18136,6 +18138,8 @@ self: super: with self; {
slob = callPackage ../development/python-modules/slob { };
slothy = callPackage ../development/python-modules/slothy { };
slovnet = callPackage ../development/python-modules/slovnet { };
slowapi = callPackage ../development/python-modules/slowapi { };