summary refs log tree commit diff
path: root/nixos/modules/system/boot/stage-1.nix
diff options
context:
space:
mode:
authorBlaž Hrastnik <blaz@mxxn.io>2020-12-16 12:37:09 +0900
committerAtemu <atemu.main@gmail.com>2020-12-28 14:25:17 +0100
commita6b5693a71fa2b8d8e50621162cd45e27fb0d5b5 (patch)
tree68af22987363a6b204d634879f1fb0b734bbc3ca /nixos/modules/system/boot/stage-1.nix
parent9461f0a73432f9d124b96f65884efba788f5c0cd (diff)
downloadnixpkgs-a6b5693a71fa2b8d8e50621162cd45e27fb0d5b5.tar
nixpkgs-a6b5693a71fa2b8d8e50621162cd45e27fb0d5b5.tar.gz
nixpkgs-a6b5693a71fa2b8d8e50621162cd45e27fb0d5b5.tar.bz2
nixpkgs-a6b5693a71fa2b8d8e50621162cd45e27fb0d5b5.tar.lz
nixpkgs-a6b5693a71fa2b8d8e50621162cd45e27fb0d5b5.tar.xz
nixpkgs-a6b5693a71fa2b8d8e50621162cd45e27fb0d5b5.tar.zst
nixpkgs-a6b5693a71fa2b8d8e50621162cd45e27fb0d5b5.zip
nixos/stage-1: set zstd as the default compressor when supported
Co-authored-by: Atemu <atemu.main@gmail.com>
Diffstat (limited to 'nixos/modules/system/boot/stage-1.nix')
-rw-r--r--nixos/modules/system/boot/stage-1.nix7
1 files changed, 6 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix
index 86bfde6349c..1fe1bb14eaf 100644
--- a/nixos/modules/system/boot/stage-1.nix
+++ b/nixos/modules/system/boot/stage-1.nix
@@ -513,7 +513,12 @@ in
     };
 
     boot.initrd.compressor = mkOption {
-      default = "gzip";
+      default = (
+        if lib.versionAtLeast config.boot.kernelPackages.kernel.version "5.9"
+        then "zstd"
+        else "gzip"
+      );
+      defaultText = "zstd if the kernel supports it (5.9+), gzip if not.";
       type = types.unspecified; # We don't have a function type...
       description = ''
         The compressor to use on the initrd image. May be any of: