Skip to content

Commit 2494e36

Browse files
splice.nix: make pkgs splicedPackages when required
This will make `pkgs` used in `callPackage`, and `pkgsCross.X.pkgs` have packages with `__spliced`. https://www.github.com/NixOS/nixpkgs/blob/3029741718f4c765fbc5ebf76bea3d6c8ff15fe5/pkgs/development/interpreters/python/passthrufun.nix#L37 https://www.github.com/NixOS/nixpkgs/blob/d2bd9a39dec88eddd5c192abee69939e67f43d12/pkgs/top-level/python-packages.nix#L10720 ``` nix-repl> pkgsCross.aarch64-multiplatform.python3Packages.protobuf4.protobuf.__spliced error: … while evaluating the attribute 'aarch64-multiplatform.python3Packages.protobuf4.protobuf.__spliced' at /home/artturin/nixgits/my-nixpkgs/.worktree/1/pkgs/development/python-modules/protobuf/4.nix:119:13: 118| passthru = { 119| inherit protobuf; | ^ 120| }; error: attribute '__spliced' missing at «string»:1:1: 1| pkgsCross.aarch64-multiplatform.python3Packages.protobuf4.protobuf.__spliced | ^ ``` to ``` nix-repl> pkgsCross.aarch64-multiplatform.python3Packages.protobuf4.protobuf.__spliced { buildBuild = «derivation /nix/store/s7da5mfvx4h1n86j78knaj9cprglxqz6-protobuf-25.4.drv»; buildHost = «derivation /nix/store/s7da5mfvx4h1n86j78knaj9cprglxqz6-protobuf-25.4.drv»; buildTarget = «repeated»; hostHost = «derivation /nix/store/mszvybzs4zxh43awyrjnybsfcb265n9r-protobuf-aarch64-unknown-linux-gnu-25.4.drv»; hostTarget = «repeated»; } ``` Co-authored-by: Wolfgang Walther <walther@technowledgy.de>
1 parent 1d4ca02 commit 2494e36

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

pkgs/development/compilers/gcc/all.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
lib,
33
stdenv,
44
pkgs,
5+
overrideCC,
6+
buildPackages,
57
targetPackages,
68
callPackage,
79
isl_0_20,
@@ -62,7 +64,7 @@ let
6264
)
6365
&& stdenv.cc.isGNU
6466
then
65-
pkgs."gcc${majorVersion}Stdenv"
67+
overrideCC stdenv buildPackages."gcc${majorVersion}"
6668
else
6769
stdenv;
6870
}

pkgs/os-specific/windows/default.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ lib.makeScope newScope (
2727
else
2828
buildPackages.gccWithoutTargetLibc.override (old: {
2929
bintools = old.bintools.override {
30-
libc = pkgs.libc;
30+
libc = pkgs.pkgsHostTarget.libc;
3131
noLibc = pkgs.libc == null;
3232
nativeLibc = false;
3333
};
34-
libc = pkgs.libc;
34+
libc = pkgs.pkgsHostTarget.libc;
3535
noLibc = pkgs.libc == null;
3636
nativeLibc = false;
3737
})

pkgs/top-level/all-packages.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6320,7 +6320,7 @@ with pkgs;
63206320
null;
63216321
bintoolsNoLibc = wrapBintoolsWith {
63226322
bintools = bintools-unwrapped;
6323-
libc = targetPackages.preLibcHeaders;
6323+
libc = targetPackages.preLibcHeaders or preLibcHeaders;
63246324
};
63256325
bintools = wrapBintoolsWith {
63266326
bintools = bintools-unwrapped;

pkgs/top-level/splice.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ in
173173

174174
newScope = extra: lib.callPackageWith (pkgsForCall // extra);
175175

176+
pkgs = if actuallySplice then splicedPackages // { recurseForDerivations = false; } else pkgs;
177+
176178
# prefill 2 fields of the function for convenience
177179
makeScopeWithSplicing = lib.makeScopeWithSplicing splicePackages pkgs.newScope;
178180
makeScopeWithSplicing' = lib.makeScopeWithSplicing' {

0 commit comments

Comments
 (0)