diff options
author | Aneesh Agrawal <aneeshusa@gmail.com> | 2016-10-30 12:35:57 -0400 |
---|---|---|
committer | Aneesh Agrawal <aneeshusa@gmail.com> | 2016-10-30 14:34:40 -0400 |
commit | 3d99eea85208d4f491e3a5c241b03d2c8d0c4125 (patch) | |
tree | 7e11be2d49a3d9202d879fb147d52cc40857c632 /nixos/doc/manual/configuration | |
parent | 3cb116f708896b2c33f5cc3a4a925fd6a762dfa0 (diff) | |
download | nixpkgs-3d99eea85208d4f491e3a5c241b03d2c8d0c4125.tar nixpkgs-3d99eea85208d4f491e3a5c241b03d2c8d0c4125.tar.gz nixpkgs-3d99eea85208d4f491e3a5c241b03d2c8d0c4125.tar.bz2 nixpkgs-3d99eea85208d4f491e3a5c241b03d2c8d0c4125.tar.lz nixpkgs-3d99eea85208d4f491e3a5c241b03d2c8d0c4125.tar.xz nixpkgs-3d99eea85208d4f491e3a5c241b03d2c8d0c4125.tar.zst nixpkgs-3d99eea85208d4f491e3a5c241b03d2c8d0c4125.zip |
docs: use overrideAttrs instead of overrideDerivation
Diffstat (limited to 'nixos/doc/manual/configuration')
-rw-r--r-- | nixos/doc/manual/configuration/customizing-packages.xml | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/nixos/doc/manual/configuration/customizing-packages.xml b/nixos/doc/manual/configuration/customizing-packages.xml index 6ee7a95dc6f..f938d6dd67e 100644 --- a/nixos/doc/manual/configuration/customizing-packages.xml +++ b/nixos/doc/manual/configuration/customizing-packages.xml @@ -42,29 +42,30 @@ construction, so without them, elements.)</para> <para>Even greater customisation is possible using the function -<varname>overrideDerivation</varname>. While the +<varname>overrideAttrs</varname>. While the <varname>override</varname> mechanism above overrides the arguments of -a package function, <varname>overrideDerivation</varname> allows -changing the <emphasis>result</emphasis> of the function. This +a package function, <varname>overrideAttrs</varname> allows +changing the <emphasis>attributes</emphasis> of the function. This permits changing any aspect of the package, such as the source code. For instance, if you want to override the source code of Emacs, you can say: <programlisting> -environment.systemPackages = - [ (pkgs.lib.overrideDerivation pkgs.emacs (attrs: { - name = "emacs-25.0-pre"; - src = /path/to/my/emacs/tree; - })) - ]; +environment.systemPackages = [ + (pkgs.emacs.overrideAttrs (oldAttrs: { + name = "emacs-25.0-pre"; + src = /path/to/my/emacs/tree; + })) +]; </programlisting> -Here, <varname>overrideDerivation</varname> takes the Nix derivation +Here, <varname>overrideAttrs</varname> takes the Nix derivation specified by <varname>pkgs.emacs</varname> and produces a new derivation in which the original’s <literal>name</literal> and <literal>src</literal> attribute have been replaced by the given -values. The original attributes are accessible via -<varname>attrs</varname>.</para> +values by re-calling <literal>stdenv.mkDerivation</literal>. +The original attributes are accessible via the function argument, +which is conventionally named <varname>oldAttrs</varname>.</para> <para>The overrides shown above are not global. They do not affect the original package; other packages in Nixpkgs continue to depend on |