diff --git a/default.nix b/default.nix index d039f2a..e7c4488 100644 --- a/default.nix +++ b/default.nix @@ -1,5 +1,13 @@ { pkgs ? import { } }: import ./lib { - inherit (pkgs) lib newScope; + inherit (pkgs) lib makeScopeWithSplicing'; + otherSplices = { + selfBuildBuild = pkgs.pkgsBuildBuild; + selfBuildHost = pkgs.pkgsBuildHost; + selfBuildTarget = pkgs.pkgsBuildTarget; + selfHostHost = pkgs.pkgsHostHost; + selfHostTarget = pkgs.pkgsHostTarget; + selfTargetTarget = pkgs.pkgsTargetTarget; + }; } diff --git a/examples/cross-rust-overlay/flake.nix b/examples/cross-rust-overlay/flake.nix index 2349f04..4261ad3 100644 --- a/examples/cross-rust-overlay/flake.nix +++ b/examples/cross-rust-overlay/flake.nix @@ -75,6 +75,7 @@ # overridden above. nativeBuildInputs = [ pkg-config + stdenv.cc ] ++ lib.optionals stdenv.buildPlatform.isDarwin [ libiconv ]; diff --git a/flake.nix b/flake.nix index 87dc12e..6900ea3 100644 --- a/flake.nix +++ b/flake.nix @@ -10,10 +10,9 @@ outputs = { nixpkgs, ... }: let - mkLib = pkgs: import ./lib { - inherit (pkgs) lib newScope; + mkLib = pkgs: import ./default.nix { + inherit pkgs; }; - nodes = (builtins.fromJSON (builtins.readFile ./test/flake.lock)).nodes; inputFromLock = name: let diff --git a/lib/default.nix b/lib/default.nix index a0e6539..67cedec 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,5 +1,6 @@ { lib -, newScope +, makeScopeWithSplicing' +, otherSplices }: let @@ -7,8 +8,12 @@ let current = lib.concatStringsSep "." (lib.lists.sublist 0 2 (lib.splitVersion lib.version)); isUnsupported = lib.versionOlder current minSupported; msg = "crane requires at least nixpkgs-${minSupported}, supplied nixpkgs-${current}"; + + mySplice = f: makeScopeWithSplicing' { + inherit otherSplices f; + }; in -lib.warnIf isUnsupported msg (lib.makeScope newScope (self: +lib.warnIf isUnsupported msg (mySplice (self: let inherit (self) callPackage; diff --git a/lib/downloadCargoPackageFromGit.nix b/lib/downloadCargoPackageFromGit.nix index 917b283..e8c0c39 100644 --- a/lib/downloadCargoPackageFromGit.nix +++ b/lib/downloadCargoPackageFromGit.nix @@ -1,12 +1,12 @@ { lib +, cargo +, jq , pkgsBuildBuild }: let inherit (pkgsBuildBuild) - cargo fetchgit - jq stdenv; craneUtils = pkgsBuildBuild.callPackage ../pkgs/crane-utils { }; @@ -42,7 +42,7 @@ stdenv.mkDerivation { dontBuild = true; dontFixup = true; - nativeBuildInputs = [ + depsBuildBuild = [ cargo craneUtils jq