From 7c60f4478ab31840d3bb4b21cdfc746937399276 Mon Sep 17 00:00:00 2001 From: Artturin Date: Thu, 17 Oct 2024 19:08:19 +0300 Subject: [PATCH 1/2] splice.nix: make `pkgs` `splicedPackages` when required MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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»; } ``` --- pkgs/top-level/splice.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/top-level/splice.nix b/pkgs/top-level/splice.nix index 3b600c22f60e8..e9e1ba02bf816 100644 --- a/pkgs/top-level/splice.nix +++ b/pkgs/top-level/splice.nix @@ -151,6 +151,8 @@ in newScope = extra: lib.callPackageWith (pkgsForCall // extra); + pkgs = if actuallySplice then splicedPackages // { recurseForDerivations = false; } else pkgs; + # prefill 2 fields of the function for convenience makeScopeWithSplicing = lib.makeScopeWithSplicing splicePackages pkgs.newScope; makeScopeWithSplicing' = lib.makeScopeWithSplicing' { inherit splicePackages; inherit (pkgs) newScope; }; From 8614381eeaca089e3244cdc99c22518daadbba49 Mon Sep 17 00:00:00 2001 From: Artturin Date: Thu, 31 Oct 2024 19:18:58 +0200 Subject: [PATCH 2/2] treewide: change `= __splicedPackages` and inherits Now that `pkgs` is `__splicedPackages` on cross we can remove these variables I set. --- pkgs/development/beam-modules/default.nix | 3 +- pkgs/development/beam-modules/lib.nix | 5 +-- .../development/interpreters/perl/default.nix | 4 --- pkgs/top-level/all-packages.nix | 32 ++++++++----------- pkgs/top-level/python-packages.nix | 5 ++- pkgs/top-level/qt5-packages.nix | 3 +- pkgs/top-level/qt6-packages.nix | 3 +- 7 files changed, 20 insertions(+), 35 deletions(-) diff --git a/pkgs/development/beam-modules/default.nix b/pkgs/development/beam-modules/default.nix index 23649ca76f261..b5a4188a0b2a1 100644 --- a/pkgs/development/beam-modules/default.nix +++ b/pkgs/development/beam-modules/default.nix @@ -1,7 +1,6 @@ -{ lib, __splicedPackages, erlang }: +{ lib, pkgs, erlang }: let - pkgs = __splicedPackages; inherit (lib) makeExtensible; lib' = pkgs.callPackage ./lib.nix { }; diff --git a/pkgs/development/beam-modules/lib.nix b/pkgs/development/beam-modules/lib.nix index 2d93b28cda6ba..1b021cf934722 100644 --- a/pkgs/development/beam-modules/lib.nix +++ b/pkgs/development/beam-modules/lib.nix @@ -1,8 +1,5 @@ -{ __splicedPackages, lib }: +{ pkgs, lib }: -let - pkgs = __splicedPackages; -in rec { /* Similar to callPackageWith/callPackage, but without makeOverridable diff --git a/pkgs/development/interpreters/perl/default.nix b/pkgs/development/interpreters/perl/default.nix index 8fd99172be109..61bffaaa4f5a0 100644 --- a/pkgs/development/interpreters/perl/default.nix +++ b/pkgs/development/interpreters/perl/default.nix @@ -19,10 +19,6 @@ let # - adds spliced package sets to the package set ({ stdenv, pkgs, perl, callPackage, makeScopeWithSplicing' }: let perlPackagesFun = callPackage ../../../top-level/perl-packages.nix { - # allow 'perlPackages.override { pkgs = pkgs // { imagemagick = imagemagickBig; }; }' like in python3Packages - # most perl packages aren't called with callPackage so it's not possible to override their arguments individually - # the conditional is because the // above won't be applied to __splicedPackages and hopefully no one is doing that when cross-compiling - pkgs = if stdenv.buildPlatform != stdenv.hostPlatform then pkgs.__splicedPackages else pkgs; inherit stdenv; perl = self; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e15dae715d48a..e3e03a5bc01f7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1036,14 +1036,14 @@ with pkgs; fetchpatch = callPackage ../build-support/fetchpatch { # 0.3.4 would change hashes: https://github.com/NixOS/nixpkgs/issues/25154 - patchutils = __splicedPackages.patchutils_0_3_3; + patchutils = pkgs.patchutils_0_3_3; } // { tests = pkgs.tests.fetchpatch; version = 1; }; fetchpatch2 = callPackage ../build-support/fetchpatch { - patchutils = __splicedPackages.patchutils_0_4_2; + patchutils = pkgs.patchutils_0_4_2; } // { tests = pkgs.tests.fetchpatch2; version = 2; @@ -1382,7 +1382,7 @@ with pkgs; wrapGAppsHook4 = wrapGAppsNoGuiHook.override { isGraphical = true; - gtk3 = __splicedPackages.gtk4; + gtk3 = pkgs.gtk4; }; wrapGAppsNoGuiHook = callPackage ../build-support/setup-hooks/wrap-gapps-hook { @@ -12820,9 +12820,7 @@ with pkgs; tmux-xpanes = callPackage ../tools/misc/tmux-xpanes { }; - tmuxPlugins = recurseIntoAttrs (callPackage ../misc/tmux-plugins { - pkgs = pkgs.__splicedPackages; - }); + tmuxPlugins = recurseIntoAttrs (callPackage ../misc/tmux-plugins { }); tncattach = callPackage ../applications/radio/tncattach { }; @@ -13879,7 +13877,7 @@ with pkgs; yarn-berry = callPackage ../development/tools/yarn-berry { }; - yarn2nix-moretea = callPackage ../development/tools/yarn2nix-moretea/yarn2nix { pkgs = pkgs.__splicedPackages; }; + yarn2nix-moretea = callPackage ../development/tools/yarn2nix-moretea/yarn2nix { }; inherit (yarn2nix-moretea) yarn2nix @@ -14928,7 +14926,6 @@ with pkgs; idrisPackages = dontRecurseIntoAttrs (callPackage ../development/idris-modules { idris-no-deps = haskellPackages.idris; - pkgs = pkgs.__splicedPackages; }); idris = idrisPackages.with-packages [ idrisPackages.base ] ; @@ -18275,7 +18272,7 @@ with pkgs; shards; shellcheck = callPackage ../development/tools/shellcheck { - inherit (__splicedPackages.haskellPackages) ShellCheck; + inherit (pkgs.haskellPackages) ShellCheck; }; @@ -22553,18 +22550,18 @@ with pkgs; qt5 = recurseIntoAttrs (makeOverridable (import ../development/libraries/qt-5/5.15) { - inherit (__splicedPackages) + inherit (pkgs) makeScopeWithSplicing' generateSplicesForMkScope lib fetchurl fetchpatch fetchgit fetchFromGitHub makeSetupHook makeWrapper bison cups dconf harfbuzz libGL perl gtk3 python3 llvmPackages_15 overrideSDK overrideLibcxx darwin; - inherit (__splicedPackages.gst_all_1) gstreamer gst-plugins-base; + inherit (pkgs.gst_all_1) gstreamer gst-plugins-base; inherit config; stdenv = if stdenv.hostPlatform.isDarwin then overrideSDK stdenv "11.0" else stdenv; }); libsForQt5 = (recurseIntoAttrs (import ./qt5-packages.nix { - inherit lib __splicedPackages makeScopeWithSplicing' generateSplicesForMkScope pkgsHostTarget; + inherit lib makeScopeWithSplicing' generateSplicesForMkScope pkgsHostTarget pkgs; })) // { __recurseIntoDerivationForReleaseJobs = true; }; # plasma5Packages maps to the Qt5 packages set that is used to build the plasma5 desktop @@ -22576,7 +22573,7 @@ with pkgs; qt6 = recurseIntoAttrs (callPackage ../development/libraries/qt-6 { }); qt6Packages = recurseIntoAttrs (import ./qt6-packages.nix { - inherit lib __splicedPackages makeScopeWithSplicing' generateSplicesForMkScope pkgsHostTarget kdePackages; + inherit lib makeScopeWithSplicing' generateSplicesForMkScope pkgsHostTarget pkgs kdePackages; stdenv = if stdenv.hostPlatform.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv; }); @@ -25198,7 +25195,7 @@ with pkgs; }; xorg = let - # Use `lib.callPackageWith __splicedPackages` rather than plain `callPackage` + # Use `lib.callPackageWith pkgs` rather than plain `callPackage` # so as not to have the newly bound xorg items already in scope, which would # have created a cycle. overrides = lib.callPackageWith __splicedPackages ../servers/x11/xorg/overrides.nix { @@ -31998,11 +31995,11 @@ with pkgs; }; qutebrowser = callPackage ../applications/networking/browsers/qutebrowser { - inherit (__splicedPackages.qt6Packages) qtbase qtwebengine wrapQtAppsHook qtwayland; + inherit (pkgs.qt6Packages) qtbase qtwebengine wrapQtAppsHook qtwayland; }; qutebrowser-qt5 = callPackage ../applications/networking/browsers/qutebrowser { - inherit (__splicedPackages.libsForQt5) qtbase qtwebengine wrapQtAppsHook qtwayland; + inherit (pkgs.libsForQt5) qtbase qtwebengine wrapQtAppsHook qtwayland; }; rakarrack = callPackage ../applications/audio/rakarrack { @@ -34809,8 +34806,7 @@ with pkgs; otto-matic = callPackage ../games/otto-matic { }; openraPackages_2019 = import ../games/openra_2019 { - inherit lib; - pkgs = pkgs.__splicedPackages; + inherit lib pkgs; }; openra_2019 = openraPackages_2019.engines.release; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index cdfaf4646b5a0..b3cb913bb418f 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -6956,8 +6956,7 @@ self: super: with self; { laspy = callPackage ../development/python-modules/laspy { }; laszip = callPackage ../development/python-modules/laszip { - inherit (pkgs) cmake ninja; - inherit (pkgs.__splicedPackages) laszip; + inherit (pkgs) cmake ninja laszip; }; latex2mathml = callPackage ../development/python-modules/latex2mathml { }; @@ -10795,7 +10794,7 @@ self: super: with self; { # Protobuf 5.x protobuf5 = callPackage ../development/python-modules/protobuf/default.nix { - inherit (pkgs.__splicedPackages) protobuf; + inherit (pkgs) protobuf; }; # If a protobuf upgrade causes many Python packages to fail, please pin it here to the previous version. diff --git a/pkgs/top-level/qt5-packages.nix b/pkgs/top-level/qt5-packages.nix index d5d6c87f9b472..204b41f52f148 100644 --- a/pkgs/top-level/qt5-packages.nix +++ b/pkgs/top-level/qt5-packages.nix @@ -7,14 +7,13 @@ { lib -, __splicedPackages , makeScopeWithSplicing' , generateSplicesForMkScope , pkgsHostTarget +, pkgs }: let - pkgs = __splicedPackages; # qt5 set should not be pre-spliced to prevent spliced packages being a part of an unspliced set # 'pkgsCross.aarch64-multiplatform.pkgsBuildTarget.targetPackages.libsForQt5.qtbase' should not have a `__spliced` but if qt5 is pre-spliced then it will have one. # pkgsHostTarget == pkgs diff --git a/pkgs/top-level/qt6-packages.nix b/pkgs/top-level/qt6-packages.nix index ebf433e667ee5..bec18c3ff680c 100644 --- a/pkgs/top-level/qt6-packages.nix +++ b/pkgs/top-level/qt6-packages.nix @@ -5,16 +5,15 @@ # this file. { lib -, __splicedPackages , makeScopeWithSplicing' , generateSplicesForMkScope , stdenv , pkgsHostTarget +, pkgs , kdePackages }: let - pkgs = __splicedPackages; # qt6 set should not be pre-spliced to prevent spliced packages being a part of an unspliced set # 'pkgsCross.aarch64-multiplatform.pkgsBuildTarget.targetPackages.qt6Packages.qtbase' should not have a `__spliced` but if qt6 is pre-spliced then it will have one. # pkgsHostTarget == pkgs