about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorWORLDofPEACE <worldofpeace@protonmail.ch>2020-09-08 19:40:45 -0400
committerGitHub <noreply@github.com>2020-09-08 19:40:45 -0400
commit2ab42dcc9e228861cec54ab346e01c9ab6e34771 (patch)
tree25811aea794ac713475a8810a3873b2ba1dfbf83 /nixos
parentd85c02ba20442e77fe6a1f685e08b0fd05f2c9bb (diff)
parent74b3d66baf2f3effb4702832fc45828291a358d8 (diff)
downloadnixlib-2ab42dcc9e228861cec54ab346e01c9ab6e34771.tar
nixlib-2ab42dcc9e228861cec54ab346e01c9ab6e34771.tar.gz
nixlib-2ab42dcc9e228861cec54ab346e01c9ab6e34771.tar.bz2
nixlib-2ab42dcc9e228861cec54ab346e01c9ab6e34771.tar.lz
nixlib-2ab42dcc9e228861cec54ab346e01c9ab6e34771.tar.xz
nixlib-2ab42dcc9e228861cec54ab346e01c9ab6e34771.tar.zst
nixlib-2ab42dcc9e228861cec54ab346e01c9ab6e34771.zip
Merge pull request #97171 from davidak/defaultPackages
nixos/config: add defaultPackages option 
Diffstat (limited to 'nixos')
-rw-r--r--nixos/doc/manual/release-notes/rl-2009.xml6
-rw-r--r--nixos/modules/config/system-path.nix23
2 files changed, 27 insertions, 2 deletions
diff --git a/nixos/doc/manual/release-notes/rl-2009.xml b/nixos/doc/manual/release-notes/rl-2009.xml
index 1b1016e92af0..c5863f3219ea 100644
--- a/nixos/doc/manual/release-notes/rl-2009.xml
+++ b/nixos/doc/manual/release-notes/rl-2009.xml
@@ -1025,7 +1025,11 @@ services.transmission.settings.rpc-bind-address = "0.0.0.0";
     <para>
      Nginx module <literal>nginxModules.fastcgi-cache-purge</literal> renamed to official name <literal>nginxModules.cache-purge</literal>.
      Nginx module <literal>nginxModules.ngx_aws_auth</literal> renamed to official name <literal>nginxModules.aws-auth</literal>.
-      The packages <package>perl</package>, <package>rsync</package> and <package>strace</package> were removed from <option>systemPackages</option>. If you need them, install them again with <code><xref linkend="opt-environment.systemPackages"/> = with pkgs; [ perl rsync strace ];</code> in your <filename>configuration.nix</filename>.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+      The option <option>defaultPackages</option> was added. It installs the packages <package>perl</package>, <package>rsync</package> and <package>strace</package> for now. They were added unconditionally to <option>systemPackages</option> before, but are not strictly necessary for a minimal NixOS install. You can set it to an empty list to have a more minimal system. Be aware that some functionality might still have an impure dependency on those packages, so things might break.
     </para>
    </listitem>
    <listitem>
diff --git a/nixos/modules/config/system-path.nix b/nixos/modules/config/system-path.nix
index b3c5c6f93f36..67305e8499cb 100644
--- a/nixos/modules/config/system-path.nix
+++ b/nixos/modules/config/system-path.nix
@@ -41,6 +41,12 @@ let
       pkgs.zstd
     ];
 
+    defaultPackages = map (pkg: setPrio ((pkg.meta.priority or 5) + 3) pkg)
+      [ pkgs.perl
+        pkgs.rsync
+        pkgs.strace
+      ];
+
 in
 
 {
@@ -63,6 +69,21 @@ in
         '';
       };
 
+      defaultPackages = mkOption {
+        type = types.listOf types.package;
+        default = defaultPackages;
+        example = literalExample "[]";
+        description = ''
+          Set of packages users expect from a minimal linux istall.
+          Like systemPackages, they appear in
+          /run/current-system/sw.  These packages are
+          automatically available to all users, and are
+          automatically updated every time you rebuild the system
+          configuration.
+          If you want a more minimal system, set it to an empty list.
+        '';
+      };
+
       pathsToLink = mkOption {
         type = types.listOf types.str;
         # Note: We need `/lib' to be among `pathsToLink' for NSS modules
@@ -102,7 +123,7 @@ in
 
   config = {
 
-    environment.systemPackages = requiredPackages;
+    environment.systemPackages = requiredPackages ++ config.environment.defaultPackages;
 
     environment.pathsToLink =
       [ "/bin"