···103104This 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.
105106-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'`.
107108```nix
109overrides = self: super: rec {
110 haskell-mode = self.melpaPackages.haskell-mode;
111 ...
112};
113-((emacsPackagesFor emacs).overrideScope' overrides).withPackages
114 (p: with p; [
115 # here both these package will use haskell-mode of our own choice
116 ghc-mod
···103104This 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.
105106+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`.
107108```nix
109overrides = self: super: rec {
110 haskell-mode = self.melpaPackages.haskell-mode;
111 ...
112};
113+((emacsPackagesFor emacs).overrideScope overrides).withPackages
114 (p: with p; [
115 # here both these package will use haskell-mode of our own choice
116 ghc-mod
···269 let self = f self // {
270 newScope = scope: newScope (self // scope);
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);
0276 packages = f;
277 };
278 in self;
···269 let self = f self // {
270 newScope = scope: newScope (self // scope);
271 callPackage = self.newScope {};
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));
277 packages = f;
278 };
279 in self;
+1-1
pkgs/build-support/emacs/wrapper.nix
···21`emacs.pkgs.emacs.pkgs.withPackages`,
22```
23let customEmacsPackages =
24- emacs.pkgs.overrideScope' (self: super: {
25 # use a custom version of emacs
26 emacs = ...;
27 # use the unstable MELPA version of magit
···21`emacs.pkgs.emacs.pkgs.withPackages`,
22```
23let customEmacsPackages =
24+ emacs.pkgs.overrideScope (self: super: {
25 # use a custom version of emacs
26 emacs = ...;
27 # use the unstable MELPA version of magit
+1-1
pkgs/development/compilers/rust/default.nix
···48 # Like `buildRustPackages`, but may also contain prebuilt binaries to
49 # break cycle. Just like `bootstrapTools` for nixpkgs as a whole,
50 # nothing in the final package set should refer to this.
51- bootstrapRustPackages = self.buildRustPackages.overrideScope' (_: _:
52 lib.optionalAttrs (stdenv.buildPlatform == stdenv.hostPlatform)
53 (selectRustPackage buildPackages).packages.prebuilt);
54 bootRustPlatform = makeRustPlatform bootstrapRustPackages;
···48 # Like `buildRustPackages`, but may also contain prebuilt binaries to
49 # break cycle. Just like `bootstrapTools` for nixpkgs as a whole,
50 # nothing in the final package set should refer to this.
51+ bootstrapRustPackages = self.buildRustPackages.overrideScope (_: _:
52 lib.optionalAttrs (stdenv.buildPlatform == stdenv.hostPlatform)
53 (selectRustPackage buildPackages).packages.prebuilt);
54 bootRustPlatform = makeRustPlatform bootstrapRustPackages;