diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix index 86bfde6349c3..1fe1bb14eaf4 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: