diff options
author | Graham Christensen <graham@grahamc.com> | 2018-05-01 19:57:09 -0400 |
---|---|---|
committer | Graham Christensen <graham@grahamc.com> | 2018-05-01 19:57:09 -0400 |
commit | eca5c99bf8a115ffd9513f91decc064a5bb3ff6d (patch) | |
tree | 7b49bc123be12ca5344428c6975e4487e69d55e3 /nixos/doc/manual/configuration/adding-custom-packages.xml | |
parent | 77161de4546697f9bf2da6d081eeba4c399b3313 (diff) | |
download | nixpkgs-eca5c99bf8a115ffd9513f91decc064a5bb3ff6d.tar nixpkgs-eca5c99bf8a115ffd9513f91decc064a5bb3ff6d.tar.gz nixpkgs-eca5c99bf8a115ffd9513f91decc064a5bb3ff6d.tar.bz2 nixpkgs-eca5c99bf8a115ffd9513f91decc064a5bb3ff6d.tar.lz nixpkgs-eca5c99bf8a115ffd9513f91decc064a5bb3ff6d.tar.xz nixpkgs-eca5c99bf8a115ffd9513f91decc064a5bb3ff6d.tar.zst nixpkgs-eca5c99bf8a115ffd9513f91decc064a5bb3ff6d.zip |
nixos docs: format =)
Diffstat (limited to 'nixos/doc/manual/configuration/adding-custom-packages.xml')
-rw-r--r-- | nixos/doc/manual/configuration/adding-custom-packages.xml | 59 |
1 files changed, 24 insertions, 35 deletions
diff --git a/nixos/doc/manual/configuration/adding-custom-packages.xml b/nixos/doc/manual/configuration/adding-custom-packages.xml index ae58f61d73e..b59287a622e 100644 --- a/nixos/doc/manual/configuration/adding-custom-packages.xml +++ b/nixos/doc/manual/configuration/adding-custom-packages.xml @@ -3,43 +3,36 @@ xmlns:xi="http://www.w3.org/2001/XInclude" version="5.0" xml:id="sec-custom-packages"> + <title>Adding Custom Packages</title> -<title>Adding Custom Packages</title> - -<para>It’s possible that a package you need is not available in NixOS. -In that case, you can do two things. First, you can clone the Nixpkgs -repository, add the package to your clone, and (optionally) submit a -patch or pull request to have it accepted into the main Nixpkgs -repository. This is described in detail in the <link -xlink:href="http://nixos.org/nixpkgs/manual">Nixpkgs manual</link>. -In short, you clone Nixpkgs: - + <para> + It’s possible that a package you need is not available in NixOS. In that + case, you can do two things. First, you can clone the Nixpkgs repository, add + the package to your clone, and (optionally) submit a patch or pull request to + have it accepted into the main Nixpkgs repository. This is described in + detail in the <link +xlink:href="http://nixos.org/nixpkgs/manual">Nixpkgs + manual</link>. In short, you clone Nixpkgs: <screen> $ git clone git://github.com/NixOS/nixpkgs.git $ cd nixpkgs </screen> - -Then you write and test the package as described in the Nixpkgs -manual. Finally, you add it to -<literal>environment.systemPackages</literal>, e.g. - + Then you write and test the package as described in the Nixpkgs manual. + Finally, you add it to <literal>environment.systemPackages</literal>, e.g. <programlisting> <xref linkend="opt-environment.systemPackages"/> = [ pkgs.my-package ]; </programlisting> - -and you run <command>nixos-rebuild</command>, specifying your own -Nixpkgs tree: - + and you run <command>nixos-rebuild</command>, specifying your own Nixpkgs + tree: <screen> # nixos-rebuild switch -I nixpkgs=/path/to/my/nixpkgs</screen> + </para> -</para> - -<para>The second possibility is to add the package outside of the -Nixpkgs tree. For instance, here is how you specify a build of the -<link xlink:href="http://www.gnu.org/software/hello/">GNU Hello</link> -package directly in <filename>configuration.nix</filename>: - + <para> + The second possibility is to add the package outside of the Nixpkgs tree. For + instance, here is how you specify a build of the + <link xlink:href="http://www.gnu.org/software/hello/">GNU Hello</link> + package directly in <filename>configuration.nix</filename>: <programlisting> <xref linkend="opt-environment.systemPackages"/> = let @@ -53,13 +46,12 @@ package directly in <filename>configuration.nix</filename>: in [ my-hello ]; </programlisting> - -Of course, you can also move the definition of -<literal>my-hello</literal> into a separate Nix expression, e.g. + Of course, you can also move the definition of <literal>my-hello</literal> + into a separate Nix expression, e.g. <programlisting> <xref linkend="opt-environment.systemPackages"/> = [ (import ./my-hello.nix) ]; </programlisting> -where <filename>my-hello.nix</filename> contains: + where <filename>my-hello.nix</filename> contains: <programlisting> with import <nixpkgs> {}; # bring all of Nixpkgs into scope @@ -71,14 +63,11 @@ stdenv.mkDerivation rec { }; } </programlisting> - -This allows testing the package easily: + This allows testing the package easily: <screen> $ nix-build my-hello.nix $ ./result/bin/hello Hello, world! </screen> - -</para> - + </para> </section> |