Skip to content

Commit

Permalink
python-bindings: use prev.callPackage to pass args
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickvP committed Apr 14, 2023
1 parent fe37fe7 commit 0ca1c82
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
5 changes: 1 addition & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,7 @@
postUnpack = "sourceRoot=$sourceRoot/perl";
});

passthru.python-bindings = final.callPackage ./python {
inherit self system;
python = final.python3;
};
passthru.python-bindings = prev.callPackage ./python { };

meta.platforms = lib.platforms.unix;
});
Expand Down
15 changes: 7 additions & 8 deletions python/default.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
self,
system,
lib,
python,
python3,
boost,
gdb,
clang-tools,
Expand All @@ -16,10 +15,10 @@
isShell ? false,
}:
let
_python = python;
_python = python3;
in
let
python = _python.override { self = enableDebugging _python; };
python3 = _python.override { self = enableDebugging _python; };
# Extracts tests/init.sh
testScripts = nix.overrideAttrs (old: {
name = "nix-test-scripts-${old.version}";
Expand All @@ -45,7 +44,7 @@ let
dontFixup = true;
});
in
python.pkgs.buildPythonPackage {
python3.pkgs.buildPythonPackage {
name = "nix";
format = "other";

Expand All @@ -64,7 +63,7 @@ python.pkgs.buildPythonPackage {
nativeBuildInputs = [
ninja
pkg-config
(meson.override { python3 = python; })
(meson.override { inherit python3; })
] ++ lib.optional (!isShell) nix;

buildInputs = nix.propagatedBuildInputs ++ [
Expand All @@ -78,10 +77,10 @@ python.pkgs.buildPythonPackage {
installCheckPhase = "meson test -v";

passthru = {
exampleEnv = python.withPackages (p: [ nix.python-bindings ]);
exampleEnv = python3.withPackages (p: [ nix.python-bindings ]);
tests = {
example-buildPythonApplication = import ./examples/buildPythonApplication {
inherit nix system testScripts python;
inherit nix system testScripts python3;
};
};
shell = mkShell {
Expand Down
6 changes: 3 additions & 3 deletions python/examples/buildPythonApplication/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
overlays = [];
inherit system;
},
python ? pkgs.python3,
python3 ? pkgs.python3,
nix ? (import ../../..).default,
testScripts,
}:
let
nixBindings = nix.python-bindings.override { inherit python; };
in python.pkgs.buildPythonApplication {
nixBindings = nix.python-bindings.override { inherit python3; };
in python3.pkgs.buildPythonApplication {
pname = "hello-nix";
version = "0.1";
src = builtins.path {
Expand Down

0 comments on commit 0ca1c82

Please sign in to comment.