Skip to content

Commit a5302d3

Browse files
committed
Nix: BUILD_ONLY_PYTHON_INTERFACE
1 parent f2eb8e5 commit a5302d3

File tree

2 files changed

+44
-10
lines changed

2 files changed

+44
-10
lines changed

flake.lock

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+40-6
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33

44
inputs = {
55
flake-parts.url = "github:hercules-ci/flake-parts";
6-
# TODO: switch back to nixos-unstable after
7-
# https://github.com/NixOS/nixpkgs/pull/357705
8-
nixpkgs.url = "github:NixOS/nixpkgs/refs/pull/357705/head";
6+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
97
};
108

119
outputs =
@@ -19,10 +17,27 @@
1917
type = "app";
2018
program = pkgs.python3.withPackages (_: [ self'.packages.default ]);
2119
};
22-
devShells.default = pkgs.mkShell { inputsFrom = [ self'.packages.default ]; };
20+
devShells.default =
21+
with pkgs;
22+
mkShell {
23+
inputsFrom = [ pkgs.python3Packages.coal ];
24+
packages =
25+
let
26+
py = p: [
27+
p.boost
28+
p.eigenpy
29+
p.numpy
30+
p.scipy
31+
];
32+
in
33+
[
34+
(python312.withPackages py)
35+
(python313.withPackages py)
36+
];
37+
};
2338
packages = {
2439
default = self'.packages.coal;
25-
coal = pkgs.python3Packages.coal.overrideAttrs (_: {
40+
coal = pkgs.coal.overrideAttrs {
2641
src = pkgs.lib.fileset.toSource {
2742
root = ./.;
2843
fileset = pkgs.lib.fileset.unions [
@@ -36,7 +51,26 @@
3651
./test
3752
];
3853
};
39-
});
54+
};
55+
py-coal =
56+
(self'.packages.coal.override {
57+
inherit (pkgs) python3Packages;
58+
pythonSupport = true;
59+
}).overrideAttrs
60+
(super: {
61+
cmakeFlags = super.cmakeFlags ++ [
62+
"-DBUILD_ONLY_PYTHON_PYTHON_INTERFACE=ON"
63+
];
64+
propagatedBuildInputs = super.propagatedBuildInputs ++ [
65+
self'.packages.coal
66+
];
67+
});
68+
py312-coal = self'.packages.py-coal.override {
69+
python3Packages = pkgs.python312Packages;
70+
};
71+
py313-coal = self'.packages.py-coal.override {
72+
python3Packages = pkgs.python313Packages;
73+
};
4074
};
4175
};
4276
};

0 commit comments

Comments
 (0)