diff --git a/debug/build_overrides.nix b/debug/build_overrides.nix index 4f4dd2d..1b5a4af 100644 --- a/debug/build_overrides.nix +++ b/debug/build_overrides.nix @@ -1,14 +1,8 @@ let - nixpkgs_commit = builtins.readFile ../mach_nix/nix/NIXPKGS_COMMIT; # nixpkgs version to use python packages from - nixpkgs_tarball_sha256 = builtins.readFile ../mach_nix/nix/NIXPKGS_SHA256; - pkgs = import (builtins.fetchTarball { - name = "nixpkgs"; - url = "https://github.com/nixos/nixpkgs/tarball/${builtins.readFile ../mach_nix/nix/NIXPKGS_COMMIT}"; - sha256 = "${builtins.readFile ../mach_nix/nix/NIXPKGS_SHA256}"; - }) { config = {}; overlays = []; }; + pkgs = import (import ../mach_nix/nix/nixpkgs-src.nix) { config = {}; overlays = []; }; python = pkgs.python37; manylinux1 = [ pkgs.pythonManylinuxPackages.manylinux1 ]; - result = import ./overrides.nix; + result = import ./overrides.nix { inherit pkgs python; }; overrides = result.overrides manylinux1 pkgs.autoPatchelfHook; py = pkgs.python37.override { packageOverrides = overrides; }; in diff --git a/flake.nix b/flake.nix index acd2c3a..d9ac192 100644 --- a/flake.nix +++ b/flake.nix @@ -3,7 +3,7 @@ description = "Create highly reproducible python environments"; inputs.flake-utils.url = "github:numtide/flake-utils"; - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/873c294e03c"; inputs.pypi-deps-db = { url = "github:DavHau/pypi-deps-db"; flake = false; diff --git a/mach_nix/flake.lock b/mach_nix/flake.lock index 865551b..8d8d9ec 100644 --- a/mach_nix/flake.lock +++ b/mach_nix/flake.lock @@ -17,16 +17,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1615259932, - "narHash": "sha256-IXecmbqCr+XCtFwzBO3tHEd8PoJ4X4EyPZebKbV2ioE=", + "lastModified": 1621687574, + "narHash": "sha256-d5GSlJC3fJqsq0nfaBrB3vN3Am2+E0AhqC6ZWS2a4qs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "29b0d4d0b600f8f5dd0b86e3362a33d4181938f9", + "rev": "873c294e03ccefb4ef4693a6a6258a2c75d44b80", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable", + "ref": "873c294e03c", "repo": "nixpkgs", "type": "github" } diff --git a/mach_nix/generators/overides_generator.py b/mach_nix/generators/overides_generator.py index 970b341..51cfee5 100644 --- a/mach_nix/generators/overides_generator.py +++ b/mach_nix/generators/overides_generator.py @@ -264,7 +264,13 @@ class OverridesGenerator(ExpressionGenerator): url = "{src_url}"; sha256 = "{src_sha256}"; }}; - format = "condabin"; + format = "other"; + nativeBuildInputs = with python.pkgs; [ + autoPatchelfHook + condaUnpackHook + condaInstallHook + ]; + buildInputs = pkgs.pythonCondaPackages.condaPatchelfLibs; passthru = (get_passthru "{name}" "{nix_name}") // {{ provider = "conda"; allCondaDeps = allCondaDepsRec pSelf; diff --git a/mach_nix/nix/buildPythonPackage.nix b/mach_nix/nix/buildPythonPackage.nix index 99bd81f..02a4a26 100644 --- a/mach_nix/nix/buildPythonPackage.nix +++ b/mach_nix/nix/buildPythonPackage.nix @@ -61,7 +61,6 @@ let }; py_final = python_pkg.override { packageOverrides = l.mergeOverrides ( overridesPre - ++ [ (import ./mk-python-derivation-overlay.nix pkgs python_pkg) ] ++ [ result.overrides ] ++ (l.fixes_to_overrides _fixes) ++ overridesPost ++ (l.simple_overrides _) diff --git a/mach_nix/nix/mk-python-derivation-overlay.nix b/mach_nix/nix/mk-python-derivation-overlay.nix index b1d2351..021cc74 100644 --- a/mach_nix/nix/mk-python-derivation-overlay.nix +++ b/mach_nix/nix/mk-python-derivation-overlay.nix @@ -27,18 +27,22 @@ pkgs: python: with pkgs.lib; in pySelf: pySuper: { buildPythonPackage = makeOverridablePythonPackage ( - makeOverridable (callPackage ./from-nixpkgs/mk-python-derivation.nix { + makeOverridable (callPackage "${pkgs.path}/pkgs/development/interpreters/python/mk-python-derivation.nix" { inherit namePrefix; # We want Python libraries to be named like e.g. "python3.6-${name}" inherit toPythonModule; # Libraries provide modules - autoPatchelfHook = callPackage ./auto_patchelf_hook.nix {}; + + # this prevents infinite recursions when overriding setuptools later + setuptools = python.pkgs.setuptools; }) ); buildPythonApplication = makeOverridablePythonPackage ( - makeOverridable (callPackage ./from-nixpkgs/mk-python-derivation.nix { + makeOverridable (callPackage "${pkgs.path}/pkgs/development/interpreters/python/mk-python-derivation.nix" { namePrefix = ""; # Python applications should not have any prefix toPythonModule = x: x; # Application does not provide modules. - autoPatchelfHook = callPackage ./auto_patchelf_hook.nix {}; + + # this prevents infinite recursions when overriding setuptools later + setuptools = python.pkgs.setuptools; }) ); } diff --git a/mach_nix/nix/mkPython.nix b/mach_nix/nix/mkPython.nix index b189624..d047e44 100644 --- a/mach_nix/nix/mkPython.nix +++ b/mach_nix/nix/mkPython.nix @@ -112,7 +112,6 @@ let all_overrides = l.mergeOverrides ( overridesPre ++ overrides_pre_extra ++ extra_pkgs_py_overrides - ++ [ (import ./mk-python-derivation-overlay.nix pkgs python_pkg) ] ++ [ result.overrides ] ++ (l.fixes_to_overrides _fixes) ++ overrides_post_extra ++ overridesPost