From 774c5a22ff958daea273bbccf3ca2981ac620a56 Mon Sep 17 00:00:00 2001 From: "Matthias J. Kannwischer" Date: Thu, 21 May 2026 22:07:15 +0800 Subject: [PATCH] python3Packages.slothy: init at 0.2.0 --- maintainers/maintainer-list.nix | 6 ++ .../python-modules/slothy/default.nix | 66 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 74 insertions(+) create mode 100644 pkgs/development/python-modules/slothy/default.nix diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index ba6d2b7ed416..c6349c226507 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -18272,6 +18272,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"; diff --git a/pkgs/development/python-modules/slothy/default.nix b/pkgs/development/python-modules/slothy/default.nix new file mode 100644 index 000000000000..f3e9b53ede81 --- /dev/null +++ b/pkgs/development/python-modules/slothy/default.nix @@ -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; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index ff35a71a67ac..cfc4581a92fd 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -18114,6 +18114,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 { };