at 23.05-pre 2.2 kB view raw
1<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xml:id="sec-declarative-package-mgmt"> 2 <title>Declarative Package Management</title> 3 <para> 4 With declarative package management, you specify which packages you 5 want on your system by setting the option 6 <xref linkend="opt-environment.systemPackages" />. For instance, 7 adding the following line to <literal>configuration.nix</literal> 8 enables the Mozilla Thunderbird email application: 9 </para> 10 <programlisting language="bash"> 11environment.systemPackages = [ pkgs.thunderbird ]; 12</programlisting> 13 <para> 14 The effect of this specification is that the Thunderbird package 15 from Nixpkgs will be built or downloaded as part of the system when 16 you run <literal>nixos-rebuild switch</literal>. 17 </para> 18 <note> 19 <para> 20 Some packages require additional global configuration such as 21 D-Bus or systemd service registration so adding them to 22 <xref linkend="opt-environment.systemPackages" /> might not be 23 sufficient. You are advised to check the 24 <link linkend="ch-options">list of options</link> whether a NixOS 25 module for the package does not exist. 26 </para> 27 </note> 28 <para> 29 You can get a list of the available packages as follows: 30 </para> 31 <programlisting> 32$ nix-env -qaP '*' --description 33nixos.firefox firefox-23.0 Mozilla Firefox - the browser, reloaded 34... 35</programlisting> 36 <para> 37 The first column in the output is the <emphasis>attribute 38 name</emphasis>, such as <literal>nixos.thunderbird</literal>. 39 </para> 40 <para> 41 Note: the <literal>nixos</literal> prefix tells us that we want to 42 get the package from the <literal>nixos</literal> channel and works 43 only in CLI tools. In declarative configuration use 44 <literal>pkgs</literal> prefix (variable). 45 </para> 46 <para> 47 To <quote>uninstall</quote> a package, simply remove it from 48 <xref linkend="opt-environment.systemPackages" /> and run 49 <literal>nixos-rebuild switch</literal>. 50 </para> 51 <xi:include href="customizing-packages.section.xml" /> 52 <xi:include href="adding-custom-packages.section.xml" /> 53</section>