Merge pull request #248988 from Artturin/matchoscopes

lib.customisation.makeScope: Make `overrideScope` consistent with `makeScopeWithSplicing`

authored by Artturi and committed by GitHub 300da0a6 0b6d3959

+16 -15
+2 -2
doc/builders/packages/emacs.section.md
··· 103 103 104 104 This provides a fairly full Emacs start file. It will load in addition to the user's personal config. You can always disable it by passing `-q` to the Emacs command. 105 105 106 - Sometimes `emacs.pkgs.withPackages` is not enough, as this package set has some priorities imposed on packages (with the lowest priority assigned to Melpa Unstable, and the highest for packages manually defined in `pkgs/top-level/emacs-packages.nix`). But you can't control these priorities when some package is installed as a dependency. You can override it on a per-package-basis, providing all the required dependencies manually, but it's tedious and there is always a possibility that an unwanted dependency will sneak in through some other package. To completely override such a package, you can use `overrideScope'`. 106 + Sometimes `emacs.pkgs.withPackages` is not enough, as this package set has some priorities imposed on packages (with the lowest priority assigned to Melpa Unstable, and the highest for packages manually defined in `pkgs/top-level/emacs-packages.nix`). But you can't control these priorities when some package is installed as a dependency. You can override it on a per-package-basis, providing all the required dependencies manually, but it's tedious and there is always a possibility that an unwanted dependency will sneak in through some other package. To completely override such a package, you can use `overrideScope`. 107 107 108 108 ```nix 109 109 overrides = self: super: rec { 110 110 haskell-mode = self.melpaPackages.haskell-mode; 111 111 ... 112 112 }; 113 - ((emacsPackagesFor emacs).overrideScope' overrides).withPackages 113 + ((emacsPackagesFor emacs).overrideScope overrides).withPackages 114 114 (p: with p; [ 115 115 # here both these package will use haskell-mode of our own choice 116 116 ghc-mod
+1 -1
doc/languages-frameworks/cuda.section.md
··· 30 30 set. 31 31 ```nix 32 32 mypkg = let 33 - cudaPackages = cudaPackages_11_5.overrideScope' (final: prev: { 33 + cudaPackages = cudaPackages_11_5.overrideScope (final: prev: { 34 34 cudnn = prev.cudnn_8_3; 35 35 }}); 36 36 in callPackage { inherit cudaPackages; };
+5 -4
lib/customisation.nix
··· 269 269 let self = f self // { 270 270 newScope = scope: newScope (self // scope); 271 271 callPackage = self.newScope {}; 272 - overrideScope = g: lib.warn 273 - "`overrideScope` (from `lib.makeScope`) is deprecated. Do `overrideScope' (self: super: { … })` instead of `overrideScope (super: self: { … })`. All other overrides have the parameters in that order, including other definitions of `overrideScope`. This was the only definition violating the pattern." 274 - (makeScope newScope (lib.fixedPoints.extends (lib.flip g) f)); 275 - overrideScope' = g: makeScope newScope (lib.fixedPoints.extends g f); 272 + overrideScope = g: makeScope newScope (lib.fixedPoints.extends g f); 273 + # Remove after 24.11 is released. 274 + overrideScope' = g: lib.warnIf (lib.isInOldestRelease 2311) 275 + "`overrideScope'` (from `lib.makeScope`) has been renamed to `overrideScope`." 276 + (makeScope newScope (lib.fixedPoints.extends g f)); 276 277 packages = f; 277 278 }; 278 279 in self;
+1 -1
pkgs/build-support/emacs/wrapper.nix
··· 21 21 `emacs.pkgs.emacs.pkgs.withPackages`, 22 22 ``` 23 23 let customEmacsPackages = 24 - emacs.pkgs.overrideScope' (self: super: { 24 + emacs.pkgs.overrideScope (self: super: { 25 25 # use a custom version of emacs 26 26 emacs = ...; 27 27 # use the unstable MELPA version of magit
+1 -1
pkgs/development/compilers/rust/default.nix
··· 48 48 # Like `buildRustPackages`, but may also contain prebuilt binaries to 49 49 # break cycle. Just like `bootstrapTools` for nixpkgs as a whole, 50 50 # nothing in the final package set should refer to this. 51 - bootstrapRustPackages = self.buildRustPackages.overrideScope' (_: _: 51 + bootstrapRustPackages = self.buildRustPackages.overrideScope (_: _: 52 52 lib.optionalAttrs (stdenv.buildPlatform == stdenv.hostPlatform) 53 53 (selectRustPackage buildPackages).packages.prebuilt); 54 54 bootRustPlatform = makeRustPlatform bootstrapRustPackages;
+1 -1
pkgs/development/interpreters/php/generic.nix
··· 85 85 86 86 php-packages = (callPackage ../../../top-level/php-packages.nix { 87 87 phpPackage = phpWithExtensions; 88 - }).overrideScope' packageOverrides; 88 + }).overrideScope packageOverrides; 89 89 90 90 allExtensionFunctions = prevExtensionFunctions ++ [ extensions ]; 91 91 enabledExtensions =
+1 -1
pkgs/development/lisp-modules/nix-cl.nix
··· 299 299 }: 300 300 let 301 301 spec = { inherit pkg faslExt program flags asdf; }; 302 - pkgs = (commonLispPackagesFor spec).overrideScope' packageOverrides; 302 + pkgs = (commonLispPackagesFor spec).overrideScope packageOverrides; 303 303 withPackages = lispWithPackages pkgs; 304 304 withOverrides = packageOverrides: 305 305 wrapLisp {
+1 -1
pkgs/development/lisp-modules/packages.nix
··· 50 50 # lispLibs ofpackages in this file. 51 51 ql = quicklispPackagesFor spec; 52 52 53 - packages = ql.overrideScope' (self: super: { 53 + packages = ql.overrideScope (self: super: { 54 54 55 55 cffi = let 56 56 jna = pkgs.fetchMavenArtifact {
+1 -1
pkgs/development/lisp-modules/ql.nix
··· 266 266 lib.optionalAttrs (builtins.pathExists ./imported.nix) 267 267 (pkgs.callPackage ./imported.nix { inherit build-asdf-system; }); 268 268 269 - in qlpkgs.overrideScope' overrides 269 + in qlpkgs.overrideScope overrides
+1 -1
pkgs/top-level/cuda-packages.nix
··· 70 70 cutensorExtension 71 71 ]); 72 72 73 - in (scope.overrideScope' composedExtension) 73 + in (scope.overrideScope composedExtension)
+1 -1
pkgs/top-level/ocaml-packages.nix
··· 1803 1803 1804 1804 ### End ### 1805 1805 1806 - })).overrideScope' liftJaneStreet; 1806 + })).overrideScope liftJaneStreet; 1807 1807 1808 1808 in let inherit (pkgs) callPackage; in rec 1809 1809 {