treewide: use uncurried version of makeScopeWithSplicing

This commit is contained in:
Adam Joseph 2023-08-14 02:49:53 +03:00 committed by Artturin
parent a1fdbae706
commit cbc8aa437c
12 changed files with 58 additions and 71 deletions

View file

@ -2,19 +2,12 @@
, lib , lib
, pkgs , pkgs
, generateSplicesForMkScope , generateSplicesForMkScope
, makeScopeWithSplicing , makeScopeWithSplicing'
}: }:
let makeScopeWithSplicing' {
keep = _self: { }; otherSplices = generateSplicesForMkScope "xfce";
extra = _spliced0: { }; f = (self:
in
makeScopeWithSplicing
(generateSplicesForMkScope "xfce")
keep
extra
(self:
let let
inherit (self) callPackage; inherit (self) callPackage;
in in
@ -177,4 +170,5 @@ makeScopeWithSplicing
thunar-bare = self.thunar.override { thunarPlugins = [ ]; }; # added 2019-11-04 thunar-bare = self.thunar.override { thunarPlugins = [ ]; }; # added 2019-11-04
xfce4-hardware-monitor-plugin = throw "xfce.xfce4-hardware-monitor-plugin has been removed: abandoned by upstream and does not build"; # added 2023-01-15 xfce4-hardware-monitor-plugin = throw "xfce.xfce4-hardware-monitor-plugin has been removed: abandoned by upstream and does not build"; # added 2023-01-15
}) });
}

View file

@ -23,7 +23,7 @@ let
# - imports lua-packages.nix # - imports lua-packages.nix
# - adds spliced package sets to the package set # - adds spliced package sets to the package set
# - applies overrides from `packageOverrides` # - applies overrides from `packageOverrides`
({ lua, overrides, callPackage, makeScopeWithSplicing }: let ({ lua, overrides, callPackage, makeScopeWithSplicing' }: let
luaPackagesFun = callPackage ../../../top-level/lua-packages.nix { luaPackagesFun = callPackage ../../../top-level/lua-packages.nix {
lua = self; lua = self;
}; };
@ -39,18 +39,15 @@ let
selfHostHost = luaOnHostForHost.pkgs; selfHostHost = luaOnHostForHost.pkgs;
selfTargetTarget = luaOnTargetForTarget.pkgs or {}; selfTargetTarget = luaOnTargetForTarget.pkgs or {};
}; };
keep = self: { };
extra = spliced0: {};
extensions = lib.composeManyExtensions [ extensions = lib.composeManyExtensions [
generatedPackages generatedPackages
overriddenPackages overriddenPackages
overrides overrides
]; ];
in makeScopeWithSplicing in makeScopeWithSplicing' {
otherSplices inherit otherSplices;
keep f = lib.extends extensions luaPackagesFun;
extra })
(lib.extends extensions luaPackagesFun))
{ {
overrides = packageOverrides; overrides = packageOverrides;
lua = self; lua = self;

View file

@ -17,7 +17,7 @@ let
# Function that when called # Function that when called
# - imports perl-packages.nix # - imports perl-packages.nix
# - adds spliced package sets to the package set # - adds spliced package sets to the package set
({ stdenv, pkgs, perl, callPackage, makeScopeWithSplicing }: let ({ stdenv, pkgs, perl, callPackage, makeScopeWithSplicing' }: let
perlPackagesFun = callPackage ../../../top-level/perl-packages.nix { perlPackagesFun = callPackage ../../../top-level/perl-packages.nix {
# allow 'perlPackages.override { pkgs = pkgs // { imagemagick = imagemagickBig; }; }' like in python3Packages # 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 # most perl packages aren't called with callPackage so it's not possible to override their arguments individually
@ -34,13 +34,10 @@ let
selfHostHost = perlOnHostForHost.pkgs; selfHostHost = perlOnHostForHost.pkgs;
selfTargetTarget = perlOnTargetForTarget.pkgs or {}; selfTargetTarget = perlOnTargetForTarget.pkgs or {};
}; };
keep = self: { }; in makeScopeWithSplicing' {
extra = spliced0: {}; inherit otherSplices;
in makeScopeWithSplicing f = perlPackagesFun;
otherSplices })
keep
extra
perlPackagesFun)
{ {
perl = self; perl = self;
}; };

View file

@ -5,7 +5,7 @@
, db , db
, lib , lib
, libffiBoot , libffiBoot
, makeScopeWithSplicing , makeScopeWithSplicing'
, pythonPackagesExtensions , pythonPackagesExtensions
, stdenv , stdenv
}@args: }@args:

View file

@ -1,4 +1,4 @@
{ lib, stdenv, callPackage, pythonPackagesExtensions, config, makeScopeWithSplicing, ... }: { lib, stdenv, callPackage, pythonPackagesExtensions, config, makeScopeWithSplicing', ... }:
{ implementation { implementation
, libPrefix , libPrefix
@ -48,7 +48,6 @@
}; };
hooks = import ./hooks/default.nix; hooks = import ./hooks/default.nix;
keep = lib.extends hooks pythonPackagesFun; keep = lib.extends hooks pythonPackagesFun;
extra = _: {};
optionalExtensions = cond: as: lib.optionals cond as; optionalExtensions = cond: as: lib.optionals cond as;
pythonExtension = import ../../../top-level/python-packages.nix; pythonExtension = import ../../../top-level/python-packages.nix;
python2Extension = import ../../../top-level/python2-packages.nix; python2Extension = import ../../../top-level/python2-packages.nix;
@ -60,12 +59,10 @@
overrides overrides
]); ]);
aliases = self: super: lib.optionalAttrs config.allowAliases (import ../../../top-level/python-aliases.nix lib self super); aliases = self: super: lib.optionalAttrs config.allowAliases (import ../../../top-level/python-aliases.nix lib self super);
in makeScopeWithSplicing in makeScopeWithSplicing' {
otherSplices inherit otherSplices keep;
keep f = lib.extends (lib.composeExtensions aliases extensions) keep;
extra }) {
(lib.extends (lib.composeExtensions aliases extensions) keep))
{
overrides = packageOverrides; overrides = packageOverrides;
python = self; python = self;
}); });

View file

@ -7,7 +7,7 @@ Check for any minor version changes.
*/ */
{ makeScopeWithSplicing, generateSplicesForMkScope { makeScopeWithSplicing', generateSplicesForMkScope
, lib, stdenv, fetchurl, fetchgit, fetchpatch, fetchFromGitHub, makeSetupHook, makeWrapper , lib, stdenv, fetchurl, fetchgit, fetchpatch, fetchFromGitHub, makeSetupHook, makeWrapper
, bison, cups ? null, harfbuzz, libGL, perl, python3 , bison, cups ? null, harfbuzz, libGL, perl, python3
, gstreamer, gst-plugins-base, gtk3, dconf , gstreamer, gst-plugins-base, gtk3, dconf
@ -331,4 +331,7 @@ let
} ../hooks/wrap-qt-apps-hook.sh; } ../hooks/wrap-qt-apps-hook.sh;
}; };
in makeScopeWithSplicing (generateSplicesForMkScope "qt5") (_: {}) (_: {}) addPackages in makeScopeWithSplicing' {
otherSplices = generateSplicesForMkScope "qt5";
f = addPackages;
}

View file

@ -166,7 +166,7 @@ let
} ./hooks/qmake-hook.sh; } ./hooks/qmake-hook.sh;
}; };
# TODO(@Artturin): convert to makeScopeWithSplicing # TODO(@Artturin): convert to makeScopeWithSplicing'
# simple example of how to do that in 5568a4d25ca406809530420996d57e0876ca1a01 # simple example of how to do that in 5568a4d25ca406809530420996d57e0876ca1a01
self = lib.makeScope newScope addPackages; self = lib.makeScope newScope addPackages;
in in

View file

@ -1,4 +1,4 @@
{ makeScopeWithSplicing, generateSplicesForMkScope { makeScopeWithSplicing', generateSplicesForMkScope
, stdenv, buildFHSEnv, pkgsi686Linux, glxinfo , stdenv, buildFHSEnv, pkgsi686Linux, glxinfo
}: }:
@ -32,6 +32,7 @@ let
steamcmd = callPackage ./steamcmd.nix { }; steamcmd = callPackage ./steamcmd.nix { };
}; };
keep = self: { }; in makeScopeWithSplicing' {
extra = spliced0: { }; otherSplices = generateSplicesForMkScope "steamPackages";
in makeScopeWithSplicing (generateSplicesForMkScope "steamPackages") keep extra steamPackagesFun f = steamPackagesFun;
}

View file

@ -1,5 +1,5 @@
{ stdenv, lib, stdenvNoCC { stdenv, lib, stdenvNoCC
, makeScopeWithSplicing, generateSplicesForMkScope , makeScopeWithSplicing', generateSplicesForMkScope
, buildPackages , buildPackages
, bsdSetupHook, makeSetupHook , bsdSetupHook, makeSetupHook
, fetchgit, fetchzip, coreutils, groff, mandoc, byacc, flex, which, m4, gawk, substituteAll, runtimeShell , fetchgit, fetchzip, coreutils, groff, mandoc, byacc, flex, which, m4, gawk, substituteAll, runtimeShell
@ -66,11 +66,9 @@ let
done done
''; '';
in makeScopeWithSplicing in makeScopeWithSplicing' {
(generateSplicesForMkScope "freebsd") otherSplices = generateSplicesForMkScope "freebsd";
(_: {}) f = (self: let
(_: {})
(self: let
inherit (self) mkDerivation; inherit (self) mkDerivation;
in { in {
inherit freebsdSrc; inherit freebsdSrc;
@ -898,4 +896,5 @@ in makeScopeWithSplicing
''; '';
}); });
}) });
}

View file

@ -1,5 +1,5 @@
{ stdenv, lib, stdenvNoCC { stdenv, lib, stdenvNoCC
, makeScopeWithSplicing, generateSplicesForMkScope , makeScopeWithSplicing', generateSplicesForMkScope
, buildPackages , buildPackages
, bsdSetupHook, makeSetupHook, fetchcvs, groff, mandoc, byacc, flex , bsdSetupHook, makeSetupHook, fetchcvs, groff, mandoc, byacc, flex
, zlib , zlib
@ -26,17 +26,15 @@ let
else "no"}" else "no"}"
]; ];
in makeScopeWithSplicing in makeScopeWithSplicing' {
(generateSplicesForMkScope "netbsd") otherSplices = generateSplicesForMkScope "netbsd";
(_: {}) f = (self: let
(_: {})
(self: let
inherit (self) mkDerivation; inherit (self) mkDerivation;
in { in {
# Why do we have splicing and yet do `nativeBuildInputs = with self; ...`? # Why do we have splicing and yet do `nativeBuildInputs = with self; ...`?
# #
# We use `makeScopeWithSplicing` because this should be used for all # We use `makeScopeWithSplicing'` because this should be used for all
# nested package sets which support cross, so the inner `callPackage` works # nested package sets which support cross, so the inner `callPackage` works
# correctly. But for the inline packages we don't bother to use # correctly. But for the inline packages we don't bother to use
# `callPackage`. # `callPackage`.
@ -1011,4 +1009,5 @@ in makeScopeWithSplicing
# END MISCELLANEOUS # END MISCELLANEOUS
# #
}) });
}

View file

@ -24479,7 +24479,7 @@ with pkgs;
qt5 = recurseIntoAttrs (makeOverridable qt5 = recurseIntoAttrs (makeOverridable
(import ../development/libraries/qt-5/5.15) { (import ../development/libraries/qt-5/5.15) {
inherit (__splicedPackages) inherit (__splicedPackages)
makeScopeWithSplicing generateSplicesForMkScope lib fetchurl fetchpatch fetchgit fetchFromGitHub makeSetupHook makeWrapper makeScopeWithSplicing' generateSplicesForMkScope lib fetchurl fetchpatch fetchgit fetchFromGitHub makeSetupHook makeWrapper
bison cups dconf harfbuzz libGL perl gtk3 python3 bison cups dconf harfbuzz libGL perl gtk3 python3
darwin buildPackages; darwin buildPackages;
inherit (__splicedPackages.gst_all_1) gstreamer gst-plugins-base; inherit (__splicedPackages.gst_all_1) gstreamer gst-plugins-base;
@ -27317,9 +27317,6 @@ with pkgs;
}; };
xorg = let xorg = let
keep = _self: { };
extra = _spliced0: { };
# Use `lib.callPackageWith __splicedPackages` rather than plain `callPackage` # Use `lib.callPackageWith __splicedPackages` rather than plain `callPackage`
# so as not to have the newly bound xorg items already in scope, which would # so as not to have the newly bound xorg items already in scope, which would
# have created a cycle. # have created a cycle.
@ -27334,11 +27331,10 @@ with pkgs;
generatedPackages = lib.callPackageWith __splicedPackages ../servers/x11/xorg/default.nix { }; generatedPackages = lib.callPackageWith __splicedPackages ../servers/x11/xorg/default.nix { };
xorgPackages = makeScopeWithSplicing xorgPackages = makeScopeWithSplicing' {
(generateSplicesForMkScope "xorg") otherSplices = generateSplicesForMkScope "xorg";
keep f = lib.extends overrides generatedPackages;
extra };
(lib.extends overrides generatedPackages);
in recurseIntoAttrs xorgPackages; in recurseIntoAttrs xorgPackages;

View file

@ -1,6 +1,6 @@
{ lib { lib
, buildPackages, pkgs, targetPackages , buildPackages, pkgs, targetPackages
, generateSplicesForMkScope, makeScopeWithSplicing , generateSplicesForMkScope, makeScopeWithSplicing'
, stdenv , stdenv
, preLibcCrossHeaders , preLibcCrossHeaders
, config , config
@ -15,7 +15,10 @@ let
(stdenv.targetPlatform.config + "-"); (stdenv.targetPlatform.config + "-");
in in
makeScopeWithSplicing (generateSplicesForMkScope "darwin") (_: {}) (spliced: spliced.apple_sdk.frameworks) (self: let makeScopeWithSplicing' {
otherSplices = generateSplicesForMkScope "darwin";
extra = spliced: spliced.apple_sdk.frameworks;
f = (self: let
inherit (self) mkDerivation callPackage; inherit (self) mkDerivation callPackage;
# Must use pkgs.callPackage to avoid infinite recursion. # Must use pkgs.callPackage to avoid infinite recursion.
@ -251,4 +254,5 @@ impure-cmds // appleSourcePackages // chooseLibs // {
} // lib.optionalAttrs config.allowAliases { } // lib.optionalAttrs config.allowAliases {
builder = throw "'darwin.builder' has been changed and renamed to 'darwin.linux-builder'. The default ssh port is now 31022. Please update your configuration or override the port back to 22. See https://nixos.org/manual/nixpkgs/unstable/#sec-darwin-builder"; # added 2023-07-06 builder = throw "'darwin.builder' has been changed and renamed to 'darwin.linux-builder'. The default ssh port is now 31022. Please update your configuration or override the port back to 22. See https://nixos.org/manual/nixpkgs/unstable/#sec-darwin-builder"; # added 2023-07-06
}) });
}