diff --git a/doc/builders/packages/emacs.section.md b/doc/builders/packages/emacs.section.md index e9b89d086d688..b4723a22bb1cc 100644 --- a/doc/builders/packages/emacs.section.md +++ b/doc/builders/packages/emacs.section.md @@ -2,12 +2,12 @@ ## Configuring Emacs {#sec-emacs-config} -The Emacs package comes with some extra helpers to make it easier to configure. `emacsWithPackages` allows you to manage packages from ELPA. This means that you will not have to install that packages from within Emacs. For instance, if you wanted to use `company` `counsel`, `flycheck`, `ivy`, `magit`, `projectile`, and `use-package` you could use this as a `~/.config/nixpkgs/config.nix` override: +The Emacs package comes with some extra helpers to make it easier to configure. `emacs.pkgs.withPackages` allows you to manage packages from ELPA. This means that you will not have to install that packages from within Emacs. For instance, if you wanted to use `company` `counsel`, `flycheck`, `ivy`, `magit`, `projectile`, and `use-package` you could use this as a `~/.config/nixpkgs/config.nix` override: ```nix { packageOverrides = pkgs: with pkgs; { - myEmacs = emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [ + myEmacs = emacs.pkgs.withPackages (epkgs: (with epkgs.melpaStablePackages; [ company counsel flycheck @@ -84,7 +84,7 @@ You can install it like any other packages via `nix-env -iA myEmacs`. However, t (projectile-global-mode)) ''; - myEmacs = emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [ + myEmacs = emacs.pkgs.withPackages (epkgs: (with epkgs.melpaStablePackages; [ (runCommand "default.el" {} '' mkdir -p $out/share/emacs/site-lisp cp ${myEmacsConfig} $out/share/emacs/site-lisp/default.el @@ -103,14 +103,14 @@ You can install it like any other packages via `nix-env -iA myEmacs`. However, t This provides a fairly full Emacs start file. It will load in addition to the user's presonal config. You can always disable it by passing `-q` to the Emacs command. -Sometimes `emacsWithPackages` 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 this priorities when some package is installed as a dependency. You can override it on 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'`. +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 this priorities when some package is installed as a dependency. You can override it on 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'`. ```nix overrides = self: super: rec { haskell-mode = self.melpaPackages.haskell-mode; ... }; -((emacsPackagesGen emacs).overrideScope' overrides).emacsWithPackages +((emacsPackagesFor emacs).overrideScope' overrides).emacs.pkgs.withPackages (p: with p; [ # here both these package will use haskell-mode of our own choice ghc-mod diff --git a/nixos/modules/services/editors/emacs.xml b/nixos/modules/services/editors/emacs.xml index 302aa1ed7c482..fd99ee9442c98 100644 --- a/nixos/modules/services/editors/emacs.xml +++ b/nixos/modules/services/editors/emacs.xml @@ -156,7 +156,7 @@ $ ./result/bin/emacs let myEmacs = pkgs.emacs; - emacsWithPackages = (pkgs.emacsPackagesGen myEmacs).emacsWithPackages; + emacsWithPackages = (pkgs.emacsPackagesFor myEmacs).emacsWithPackages; in emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [ magit # ; Integrate git <C-x g> @@ -254,10 +254,10 @@ in Querying Emacs packages " -qaP -A emacsPackages.elpaPackages -nix-env -f "" -qaP -A emacsPackages.melpaPackages -nix-env -f "" -qaP -A emacsPackages.melpaStablePackages -nix-env -f "" -qaP -A emacsPackages.orgPackages +nix-env -f "" -qaP -A emacs.pkgs.elpaPackages +nix-env -f "" -qaP -A emacs.pkgs.melpaPackages +nix-env -f "" -qaP -A emacs.pkgs.melpaStablePackages +nix-env -f "" -qaP -A emacs.pkgs.orgPackages ]]> diff --git a/nixos/modules/services/x11/window-managers/exwm.nix b/nixos/modules/services/x11/window-managers/exwm.nix index 88e13f4dbfb07..3e97d28d83b54 100644 --- a/nixos/modules/services/x11/window-managers/exwm.nix +++ b/nixos/modules/services/x11/window-managers/exwm.nix @@ -48,7 +48,7 @@ in description = '' Extra packages available to Emacs. The value must be a function which receives the attrset defined in - emacsPackages as the sole argument. + emacs.pkgs as the sole argument. ''; }; }; diff --git a/pkgs/applications/editors/emacs-modes/elpa-packages.nix b/pkgs/applications/editors/emacs-modes/elpa-packages.nix index 57f5d7b859411..8b9ad33fce78a 100644 --- a/pkgs/applications/editors/emacs-modes/elpa-packages.nix +++ b/pkgs/applications/editors/emacs-modes/elpa-packages.nix @@ -5,7 +5,7 @@ To update the list of packages from MELPA, 1. Run `./update-elpa`. -2. Check for evaluation errors: `nix-instantiate ../../../.. -A emacsPackagesNg.elpaPackages`. +2. Check for evaluation errors: `nix-instantiate ../../../.. -A emacs.pkgs.elpaPackages`. 3. `git commit -m "elpa-packages $(date -Idate)" -- elpa-generated.nix` ## Update from overlay diff --git a/pkgs/applications/editors/emacs-modes/melpa-packages.nix b/pkgs/applications/editors/emacs-modes/melpa-packages.nix index a47688eca7e46..93e215753c792 100644 --- a/pkgs/applications/editors/emacs-modes/melpa-packages.nix +++ b/pkgs/applications/editors/emacs-modes/melpa-packages.nix @@ -6,8 +6,8 @@ To update the list of packages from MELPA, 1. Run ./update-melpa 2. Check for evaluation errors: -env NIXPKGS_ALLOW_BROKEN=1 nix-instantiate --show-trace ../../../../ -A emacsPackages.melpaStablePackages -env NIXPKGS_ALLOW_BROKEN=1 nix-instantiate --show-trace ../../../../ -A emacsPackages.melpaPackages +env NIXPKGS_ALLOW_BROKEN=1 nix-instantiate --show-trace ../../../../ -A emacs.pkgs..melpaStablePackages +env NIXPKGS_ALLOW_BROKEN=1 nix-instantiate --show-trace ../../../../ -A emacs.pkgs..melpaPackages 3. `git commit -m "melpa-packages: $(date -Idate)" recipes-archive-melpa.json` ## Update from overlay diff --git a/pkgs/applications/editors/emacs-modes/org-packages.nix b/pkgs/applications/editors/emacs-modes/org-packages.nix index 1f37cf624f9f4..b60af0e9334bc 100644 --- a/pkgs/applications/editors/emacs-modes/org-packages.nix +++ b/pkgs/applications/editors/emacs-modes/org-packages.nix @@ -5,7 +5,7 @@ To update the list of packages from Org (ELPA), 1. Run `./update-org`. -2. Check for evaluation errors: `nix-instantiate ../../../.. -A emacsPackagesNg.orgPackages`. +2. Check for evaluation errors: `nix-instantiate ../../../.. -A emacs.pkgs.orgPackages`. 3. `git commit -m "org-packages $(date -Idate)" -- org-generated.nix` */ diff --git a/pkgs/applications/editors/emacs-modes/update-from-overlay b/pkgs/applications/editors/emacs-modes/update-from-overlay index d65e93e3e4d2b..886019716d49d 100755 --- a/pkgs/applications/editors/emacs-modes/update-from-overlay +++ b/pkgs/applications/editors/emacs-modes/update-from-overlay @@ -8,14 +8,14 @@ export NIXPKGS_ALLOW_BROKEN=1 # You can use this to avoid running lengthy code generation jobs locally curl -s -O https://raw.githubusercontent.com/nix-community/emacs-overlay/master/repos/elpa/elpa-generated.nix -nix-instantiate ../../../.. -A emacsPackagesNg.elpaPackages --show-trace -git diff --exit-code elpa-generated.nix > /dev/null || git commit -m "emacsPackages.elpa-packages: $(date --iso)" -- elpa-generated.nix +nix-instantiate ../../../.. -A emacs.pkgs.elpaPackages --show-trace +git diff --exit-code elpa-generated.nix > /dev/null || git commit -m "emacs.pkgs.elpa-packages: $(date --iso)" -- elpa-generated.nix curl -s -O https://raw.githubusercontent.com/nix-community/emacs-overlay/master/repos/org/org-generated.nix -nix-instantiate ../../../.. -A emacsPackagesNg.orgPackages --show-trace -git diff --exit-code org-generated.nix > /dev/null || git commit -m "emacsPackages.org-packages: $(date --iso)" -- org-generated.nix +nix-instantiate ../../../.. -A emacs.pkgs.orgPackages --show-trace +git diff --exit-code org-generated.nix > /dev/null || git commit -m "emacs.pkgs.org-packages: $(date --iso)" -- org-generated.nix curl -s -O https://raw.githubusercontent.com/nix-community/emacs-overlay/master/repos/melpa/recipes-archive-melpa.json -env nix-instantiate --show-trace ../../../../ -A emacsPackages.melpaStablePackages -env nix-instantiate --show-trace ../../../../ -A emacsPackages.melpaPackages -git diff --exit-code recipes-archive-melpa.json > /dev/null || git commit -m "emacsPackages.melpa-packages: $(date --iso)" -- recipes-archive-melpa.json +nix-instantiate --show-trace ../../../../ -A emacs.pkgs.melpaStablePackages +nix-instantiate --show-trace ../../../../ -A emacs.pkgs.melpaPackages +git diff --exit-code recipes-archive-melpa.json > /dev/null || git commit -m "emacs.pkgs.melpa-packages: $(date --iso)" -- recipes-archive-melpa.json diff --git a/pkgs/applications/editors/emacs-modes/updater-emacs.nix b/pkgs/applications/editors/emacs-modes/updater-emacs.nix index b5de993eaa766..bd965c8f12853 100644 --- a/pkgs/applications/editors/emacs-modes/updater-emacs.nix +++ b/pkgs/applications/editors/emacs-modes/updater-emacs.nix @@ -1,7 +1,7 @@ let pkgs = import ../../../.. {}; - emacsEnv = (pkgs.emacsPackagesFor pkgs.emacs).emacsWithPackages (epkgs: let + emacsEnv = pkgs.emacs.withPackages (epkgs: let promise = epkgs.trivialBuild { pname = "promise"; diff --git a/pkgs/build-support/emacs/wrapper.nix b/pkgs/build-support/emacs/wrapper.nix index ddd150656632a..f34835eaf096b 100644 --- a/pkgs/build-support/emacs/wrapper.nix +++ b/pkgs/build-support/emacs/wrapper.nix @@ -2,11 +2,11 @@ # Usage -`emacsWithPackages` takes a single argument: a function from a package +`emacs.pkgs.withPackages` takes a single argument: a function from a package set to a list of packages (the packages that will be available in Emacs). For example, ``` -emacsWithPackages (epkgs: [ epkgs.evil epkgs.magit ]) +emacs.pkgs.withPackages (epkgs: [ epkgs.evil epkgs.magit ]) ``` All the packages in the list should come from the provided package set. It is possible to add any package to the list, but the provided @@ -15,19 +15,19 @@ the correct version of Emacs. # Overriding -`emacsWithPackages` inherits the package set which contains it, so the +`emacs.pkgs.withPackages` inherits the package set which contains it, so the correct way to override the provided package set is to override the -set which contains `emacsWithPackages`. For example, to override -`emacsPackages.emacsWithPackages`, +set which contains `emacs.pkgs.withPackages`. For example, to override +`emacs.pkgs.emacs.pkgs.withPackages`, ``` let customEmacsPackages = - emacsPackages.overrideScope' (self: super: { + emacs.pkgs.overrideScope' (self: super: { # use a custom version of emacs emacs = ...; # use the unstable MELPA version of magit magit = self.melpaPackages.magit; }); -in customEmacsPackages.emacsWithPackages (epkgs: [ epkgs.evil epkgs.magit ]) +in customEmacsPackages.emacs.pkgs.withPackages (epkgs: [ epkgs.evil epkgs.magit ]) ``` */ diff --git a/pkgs/development/tools/cask/default.nix b/pkgs/development/tools/cask/default.nix index 925d10b23b44c..ab7a7c0fdff8a 100644 --- a/pkgs/development/tools/cask/default.nix +++ b/pkgs/development/tools/cask/default.nix @@ -1,14 +1,14 @@ -{ stdenv, fetchurl, python, emacsPackages }: +{ stdenv, fetchurl, python, emacs }: stdenv.mkDerivation rec { pname = "cask"; - inherit (emacsPackages.melpaStablePackages.cask) src version; + inherit (emacs.pkgs.melpaStablePackages.cask) src version; doCheck = true; - nativeBuildInputs = [ emacsPackages.emacs ]; - buildInputs = with emacsPackages; [ + nativeBuildInputs = [ emacs ]; + buildInputs = with emacs.pkgs; [ s f dash ansi ecukes servant ert-runner el-mock noflet ert-async shell-split-string git package-build ] ++ [ diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7aefe36836826..30787fac2c295 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -500,7 +500,7 @@ in mkShell = callPackage ../build-support/mkshell { }; - nixBufferBuilders = import ../build-support/emacs/buffer.nix { inherit (pkgs) lib writeText; inherit (emacsPackages) inherit-local; }; + nixBufferBuilders = import ../build-support/emacs/buffer.nix { inherit (pkgs) lib writeText; inherit (emacs.pkgs) inherit-local; }; nix-gitignore = callPackage ../build-support/nix-gitignore { }; @@ -9788,7 +9788,7 @@ in # package. Wishing we could merge it into one irony package, to avoid this issue, # but its emacs-side expression is autogenerated, and we can't hook into it (other # than peek into its version). - inherit (emacsPackages.melpaStablePackages) irony; + inherit (emacs.pkgs.melpaStablePackages) irony; }; hugs = callPackage ../development/interpreters/hugs { }; @@ -21424,9 +21424,7 @@ in elvis = callPackage ../applications/editors/elvis { }; emacs = emacs27; - emacsPackages = emacs27Packages; emacs-nox = emacs27-nox; - emacsWithPackages = emacsPackages.emacsWithPackages; emacs27 = callPackage ../applications/editors/emacs/27.nix { # use override to enable additional features diff --git a/pkgs/top-level/packages-config.nix b/pkgs/top-level/packages-config.nix index 52ad7aecd2848..d0a71c43a962a 100644 --- a/pkgs/top-level/packages-config.nix +++ b/pkgs/top-level/packages-config.nix @@ -34,8 +34,8 @@ "nvidiaPackages" "sourceHanPackages" "atomPackages" - "emacs26Packages" - "emacs27Packages" + "emacs26.pkgs" + "emacs27.pkgs" "steamPackages" "ut2004Packages" "zeroadPackages"