treewide: emacsPackages -> emacs.pkgs & emacsWithPackages -> emacs.pkgs.withPackages
The previous names are now aliases and shouldn't be used anywhere inside nixpkgs.
This commit is contained in:
parent
6347f78fd9
commit
4003f8cbc7
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
## Configuring Emacs {#sec-emacs-config}
|
## 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
|
```nix
|
||||||
{
|
{
|
||||||
packageOverrides = pkgs: with pkgs; {
|
packageOverrides = pkgs: with pkgs; {
|
||||||
myEmacs = emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [
|
myEmacs = emacs.pkgs.withPackages (epkgs: (with epkgs.melpaStablePackages; [
|
||||||
company
|
company
|
||||||
counsel
|
counsel
|
||||||
flycheck
|
flycheck
|
||||||
|
@ -84,7 +84,7 @@ You can install it like any other packages via `nix-env -iA myEmacs`. However, t
|
||||||
(projectile-global-mode))
|
(projectile-global-mode))
|
||||||
'';
|
'';
|
||||||
|
|
||||||
myEmacs = emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [
|
myEmacs = emacs.pkgs.withPackages (epkgs: (with epkgs.melpaStablePackages; [
|
||||||
(runCommand "default.el" {} ''
|
(runCommand "default.el" {} ''
|
||||||
mkdir -p $out/share/emacs/site-lisp
|
mkdir -p $out/share/emacs/site-lisp
|
||||||
cp ${myEmacsConfig} $out/share/emacs/site-lisp/default.el
|
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.
|
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
|
```nix
|
||||||
overrides = self: super: rec {
|
overrides = self: super: rec {
|
||||||
haskell-mode = self.melpaPackages.haskell-mode;
|
haskell-mode = self.melpaPackages.haskell-mode;
|
||||||
...
|
...
|
||||||
};
|
};
|
||||||
((emacsPackagesGen emacs).overrideScope' overrides).emacsWithPackages
|
((emacsPackagesFor emacs).overrideScope' overrides).emacs.pkgs.withPackages
|
||||||
(p: with p; [
|
(p: with p; [
|
||||||
# here both these package will use haskell-mode of our own choice
|
# here both these package will use haskell-mode of our own choice
|
||||||
ghc-mod
|
ghc-mod
|
||||||
|
|
|
@ -156,7 +156,7 @@ $ ./result/bin/emacs
|
||||||
|
|
||||||
let
|
let
|
||||||
myEmacs = pkgs.emacs; <co xml:id="ex-emacsNix-2" />
|
myEmacs = pkgs.emacs; <co xml:id="ex-emacsNix-2" />
|
||||||
emacsWithPackages = (pkgs.emacsPackagesGen myEmacs).emacsWithPackages; <co xml:id="ex-emacsNix-3" />
|
emacsWithPackages = (pkgs.emacsPackagesFor myEmacs).emacsWithPackages; <co xml:id="ex-emacsNix-3" />
|
||||||
in
|
in
|
||||||
emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [ <co xml:id="ex-emacsNix-4" />
|
emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [ <co xml:id="ex-emacsNix-4" />
|
||||||
magit # ; Integrate git <C-x g>
|
magit # ; Integrate git <C-x g>
|
||||||
|
@ -254,10 +254,10 @@ in
|
||||||
<example xml:id="module-services-emacs-querying-packages">
|
<example xml:id="module-services-emacs-querying-packages">
|
||||||
<title>Querying Emacs packages</title>
|
<title>Querying Emacs packages</title>
|
||||||
<programlisting><![CDATA[
|
<programlisting><![CDATA[
|
||||||
nix-env -f "<nixpkgs>" -qaP -A emacsPackages.elpaPackages
|
nix-env -f "<nixpkgs>" -qaP -A emacs.pkgs.elpaPackages
|
||||||
nix-env -f "<nixpkgs>" -qaP -A emacsPackages.melpaPackages
|
nix-env -f "<nixpkgs>" -qaP -A emacs.pkgs.melpaPackages
|
||||||
nix-env -f "<nixpkgs>" -qaP -A emacsPackages.melpaStablePackages
|
nix-env -f "<nixpkgs>" -qaP -A emacs.pkgs.melpaStablePackages
|
||||||
nix-env -f "<nixpkgs>" -qaP -A emacsPackages.orgPackages
|
nix-env -f "<nixpkgs>" -qaP -A emacs.pkgs.orgPackages
|
||||||
]]></programlisting>
|
]]></programlisting>
|
||||||
</example>
|
</example>
|
||||||
</para>
|
</para>
|
||||||
|
|
|
@ -48,7 +48,7 @@ in
|
||||||
description = ''
|
description = ''
|
||||||
Extra packages available to Emacs. The value must be a
|
Extra packages available to Emacs. The value must be a
|
||||||
function which receives the attrset defined in
|
function which receives the attrset defined in
|
||||||
<varname>emacsPackages</varname> as the sole argument.
|
<varname>emacs.pkgs</varname> as the sole argument.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
To update the list of packages from MELPA,
|
To update the list of packages from MELPA,
|
||||||
|
|
||||||
1. Run `./update-elpa`.
|
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`
|
3. `git commit -m "elpa-packages $(date -Idate)" -- elpa-generated.nix`
|
||||||
|
|
||||||
## Update from overlay
|
## Update from overlay
|
||||||
|
|
|
@ -6,8 +6,8 @@ To update the list of packages from MELPA,
|
||||||
|
|
||||||
1. Run ./update-melpa
|
1. Run ./update-melpa
|
||||||
2. Check for evaluation errors:
|
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 emacs.pkgs..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..melpaPackages
|
||||||
3. `git commit -m "melpa-packages: $(date -Idate)" recipes-archive-melpa.json`
|
3. `git commit -m "melpa-packages: $(date -Idate)" recipes-archive-melpa.json`
|
||||||
|
|
||||||
## Update from overlay
|
## Update from overlay
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
To update the list of packages from Org (ELPA),
|
To update the list of packages from Org (ELPA),
|
||||||
|
|
||||||
1. Run `./update-org`.
|
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`
|
3. `git commit -m "org-packages $(date -Idate)" -- org-generated.nix`
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -8,14 +8,14 @@ export NIXPKGS_ALLOW_BROKEN=1
|
||||||
# You can use this to avoid running lengthy code generation jobs locally
|
# 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
|
curl -s -O https://raw.githubusercontent.com/nix-community/emacs-overlay/master/repos/elpa/elpa-generated.nix
|
||||||
nix-instantiate ../../../.. -A emacsPackagesNg.elpaPackages --show-trace
|
nix-instantiate ../../../.. -A emacs.pkgs.elpaPackages --show-trace
|
||||||
git diff --exit-code elpa-generated.nix > /dev/null || git commit -m "emacsPackages.elpa-packages: $(date --iso)" -- elpa-generated.nix
|
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
|
curl -s -O https://raw.githubusercontent.com/nix-community/emacs-overlay/master/repos/org/org-generated.nix
|
||||||
nix-instantiate ../../../.. -A emacsPackagesNg.orgPackages --show-trace
|
nix-instantiate ../../../.. -A emacs.pkgs.orgPackages --show-trace
|
||||||
git diff --exit-code org-generated.nix > /dev/null || git commit -m "emacsPackages.org-packages: $(date --iso)" -- org-generated.nix
|
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
|
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
|
nix-instantiate --show-trace ../../../../ -A emacs.pkgs.melpaStablePackages
|
||||||
env nix-instantiate --show-trace ../../../../ -A emacsPackages.melpaPackages
|
nix-instantiate --show-trace ../../../../ -A emacs.pkgs.melpaPackages
|
||||||
git diff --exit-code recipes-archive-melpa.json > /dev/null || git commit -m "emacsPackages.melpa-packages: $(date --iso)" -- recipes-archive-melpa.json
|
git diff --exit-code recipes-archive-melpa.json > /dev/null || git commit -m "emacs.pkgs.melpa-packages: $(date --iso)" -- recipes-archive-melpa.json
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
let
|
let
|
||||||
pkgs = import ../../../.. {};
|
pkgs = import ../../../.. {};
|
||||||
|
|
||||||
emacsEnv = (pkgs.emacsPackagesFor pkgs.emacs).emacsWithPackages (epkgs: let
|
emacsEnv = pkgs.emacs.withPackages (epkgs: let
|
||||||
|
|
||||||
promise = epkgs.trivialBuild {
|
promise = epkgs.trivialBuild {
|
||||||
pname = "promise";
|
pname = "promise";
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
# Usage
|
# 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
|
set to a list of packages (the packages that will be available in
|
||||||
Emacs). For example,
|
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
|
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
|
set. It is possible to add any package to the list, but the provided
|
||||||
|
@ -15,19 +15,19 @@ the correct version of Emacs.
|
||||||
|
|
||||||
# Overriding
|
# 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
|
correct way to override the provided package set is to override the
|
||||||
set which contains `emacsWithPackages`. For example, to override
|
set which contains `emacs.pkgs.withPackages`. For example, to override
|
||||||
`emacsPackages.emacsWithPackages`,
|
`emacs.pkgs.emacs.pkgs.withPackages`,
|
||||||
```
|
```
|
||||||
let customEmacsPackages =
|
let customEmacsPackages =
|
||||||
emacsPackages.overrideScope' (self: super: {
|
emacs.pkgs.overrideScope' (self: super: {
|
||||||
# use a custom version of emacs
|
# use a custom version of emacs
|
||||||
emacs = ...;
|
emacs = ...;
|
||||||
# use the unstable MELPA version of magit
|
# use the unstable MELPA version of magit
|
||||||
magit = self.melpaPackages.magit;
|
magit = self.melpaPackages.magit;
|
||||||
});
|
});
|
||||||
in customEmacsPackages.emacsWithPackages (epkgs: [ epkgs.evil epkgs.magit ])
|
in customEmacsPackages.emacs.pkgs.withPackages (epkgs: [ epkgs.evil epkgs.magit ])
|
||||||
```
|
```
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
{ stdenv, fetchurl, python, emacsPackages }:
|
{ stdenv, fetchurl, python, emacs }:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "cask";
|
pname = "cask";
|
||||||
|
|
||||||
inherit (emacsPackages.melpaStablePackages.cask) src version;
|
inherit (emacs.pkgs.melpaStablePackages.cask) src version;
|
||||||
|
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
|
|
||||||
nativeBuildInputs = [ emacsPackages.emacs ];
|
nativeBuildInputs = [ emacs ];
|
||||||
buildInputs = with emacsPackages; [
|
buildInputs = with emacs.pkgs; [
|
||||||
s f dash ansi ecukes servant ert-runner el-mock
|
s f dash ansi ecukes servant ert-runner el-mock
|
||||||
noflet ert-async shell-split-string git package-build
|
noflet ert-async shell-split-string git package-build
|
||||||
] ++ [
|
] ++ [
|
||||||
|
|
|
@ -500,7 +500,7 @@ in
|
||||||
|
|
||||||
mkShell = callPackage ../build-support/mkshell { };
|
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 { };
|
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,
|
# 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
|
# but its emacs-side expression is autogenerated, and we can't hook into it (other
|
||||||
# than peek into its version).
|
# than peek into its version).
|
||||||
inherit (emacsPackages.melpaStablePackages) irony;
|
inherit (emacs.pkgs.melpaStablePackages) irony;
|
||||||
};
|
};
|
||||||
|
|
||||||
hugs = callPackage ../development/interpreters/hugs { };
|
hugs = callPackage ../development/interpreters/hugs { };
|
||||||
|
@ -21424,9 +21424,7 @@ in
|
||||||
elvis = callPackage ../applications/editors/elvis { };
|
elvis = callPackage ../applications/editors/elvis { };
|
||||||
|
|
||||||
emacs = emacs27;
|
emacs = emacs27;
|
||||||
emacsPackages = emacs27Packages;
|
|
||||||
emacs-nox = emacs27-nox;
|
emacs-nox = emacs27-nox;
|
||||||
emacsWithPackages = emacsPackages.emacsWithPackages;
|
|
||||||
|
|
||||||
emacs27 = callPackage ../applications/editors/emacs/27.nix {
|
emacs27 = callPackage ../applications/editors/emacs/27.nix {
|
||||||
# use override to enable additional features
|
# use override to enable additional features
|
||||||
|
|
|
@ -34,8 +34,8 @@
|
||||||
"nvidiaPackages"
|
"nvidiaPackages"
|
||||||
"sourceHanPackages"
|
"sourceHanPackages"
|
||||||
"atomPackages"
|
"atomPackages"
|
||||||
"emacs26Packages"
|
"emacs26.pkgs"
|
||||||
"emacs27Packages"
|
"emacs27.pkgs"
|
||||||
"steamPackages"
|
"steamPackages"
|
||||||
"ut2004Packages"
|
"ut2004Packages"
|
||||||
"zeroadPackages"
|
"zeroadPackages"
|
||||||
|
|
Loading…
Reference in New Issue