Skip to content

Commit 669ac38

Browse files
committed
SLOTHY: Update ortools to 9.12
This updates ortools used in SLOTHY to 9.12. In our CI we significantly better performance (5.5-6 minutes vs. 8-10 minutes for the optimization of all asm). ortools v9.12 requires a newer protobuf version than what is in nixpkgs - we instead fetch it from pypi directly. There is quite a bit of potential in this PR for clean-up when nixpkgs 25.05 is released. Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
1 parent ad7a6f9 commit 669ac38

File tree

1 file changed

+53
-21
lines changed

1 file changed

+53
-21
lines changed

nix/slothy/default.nix

Lines changed: 53 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
{ stdenvNoCC
44
, fetchFromGitHub
5-
, python311
5+
, python312
66
, pkgs
7-
, callPackage
8-
, python311Packages
7+
, python312Packages
98
, fetchPypi
109
, stdenv
1110
, cmake
@@ -16,54 +15,87 @@
1615

1716

1817
let
19-
ortools97 = python311Packages.buildPythonPackage rec {
18+
# TODO: switch to protobuf from nixpkgs
19+
# ortools 9.12 requires protobuf >= 5.29.3 - currently nixpkgs 24.11 has
20+
# protobuf 5.28.3
21+
protobuf_6_30_1 = python312Packages.buildPythonPackage rec {
22+
pname = "protobuf";
23+
version = "6.30.1";
24+
25+
propagatedBuildInputs = [
26+
python312Packages.setuptools
27+
];
28+
29+
build-system = with python312Packages; [
30+
setuptools
31+
];
32+
33+
dontConfigure = true;
34+
nativeBuildInputs =
35+
[
36+
cmake
37+
pkg-config
38+
];
39+
40+
src = fetchPypi {
41+
inherit pname version;
42+
hash = "sha256-U1+05E0CNok9XPEmOg9wbxFgtomnq5YunaipzkBQt4A=";
43+
};
44+
};
45+
46+
47+
ortools912 = python312Packages.buildPythonPackage rec {
2048
pname = "ortools";
21-
version = "9.7.2996";
49+
version = "9.12.4544";
2250

2351
format = "wheel";
2452

2553
src = fetchPypi {
2654
inherit pname version;
2755
format = "wheel";
28-
dist = "cp311";
29-
python = "cp311";
30-
abi = "cp311";
56+
dist = "cp312";
57+
python = "cp312";
58+
abi = "cp312";
3159
platform =
3260
if stdenv.isDarwin then
3361
if stdenv.isAarch64 then "macosx_11_0_arm64"
3462
else "macosx_10_15_x86_64"
3563
else if stdenv.isLinux then
36-
if stdenv.isAarch64 then "manylinux_2_17_aarch64.manylinux2014_aarch64"
37-
else "manylinux_2_17_x86_64.manylinux2014_x86_64"
64+
if stdenv.isAarch64 then "manylinux_2_27_aarch64.manylinux_2_28_aarch64"
65+
else "manylinux_2_27_x86_64.manylinux_2_28_x86_64"
3866
else throw "Unsupported platform";
3967

4068
hash =
4169
if stdenv.isDarwin then
42-
if stdenv.isAarch64 then "sha256-Oc8xz9iRuOiDyZBc85qlS57u0efP/f4cDpi2k9ZlCQI="
43-
else "sha256-0ax/I7604BumV+VRV7Y5fNDs0XrxkK+ocr9yU1oFMDQ="
70+
if stdenv.isAarch64 then "sha256-Z/4bhlMndFZ4okBm2CbbJaEBmqIH6pAXygGvLPIUVlI="
71+
else "sha256-FnaLGfyzBT9EvYTEYMuXjyop1046XZugYSNYn+sQrxI="
4472
else if stdenv.isLinux then
45-
if stdenv.isAarch64 then "sha256-B8QfDoYT2OxrpoUzSQTNduRbxG2j1S8XPpMBZo/yI90="
46-
else "sha256-pUerlb2cykE9cYraz68MnuBKDM4V1Du0Ta3yve16K/o="
73+
if stdenv.isAarch64 then "sha256-VVD+nuVSt7jtAcrZHVimjsDkjNQN0necELGZFCmncFg="
74+
else "sha256-kiEh1vSPjuseuIqMZF/wC2H2CFYxkxTOK48iD6uJYIM="
4775
else throw "Unsupported platform";
4876
};
4977

50-
propagatedBuildInputs = with python311Packages; [
78+
propagatedBuildInputs = with python312Packages; [
5179
numpy
5280
pandas
53-
protobuf
81+
protobuf_6_30_1
5482
];
5583

5684
};
5785

58-
unicorn_2_1_3 = python311Packages.buildPythonPackage rec {
86+
# TODO: switch to unicorn from nixpkgs
87+
# nixpkgs 24.11 currently has 2.1.1 - we are experiencing some issues with
88+
# that version on MacOS. 2.1.2/2.1.3 (and also some older versions) don't
89+
# have that problem
90+
unicorn_2_1_3 = python312Packages.buildPythonPackage rec {
5991
pname = "unicorn";
6092
version = "2.1.3";
6193

6294
propagatedBuildInputs = [
63-
python311Packages.setuptools
95+
python312Packages.setuptools
6496
];
6597

66-
build-system = with python311Packages; [
98+
build-system = with python312Packages; [
6799
setuptools
68100
];
69101

@@ -80,8 +112,8 @@ let
80112
};
81113
};
82114

83-
pythonEnv = python311.withPackages (ps: with ps; [
84-
ortools97
115+
pythonEnv = python312.withPackages (ps: with ps; [
116+
ortools912
85117
sympy
86118
unicorn_2_1_3
87119
]);

0 commit comments

Comments
 (0)