@@ -680,7 +680,14 @@ let
680680 DEBUG_MEMORY_INIT = option yes;
681681 });
682682
683− misc = {
683+ misc = let
684+ # Use zstd for kernel compression if 64-bit and newer than 5.9, otherwise xz.
685+ # i686 issues: https://github.com/NixOS/nixpkgs/pull/117961#issuecomment-812106375
686+ useZstd = stdenv.buildPlatform.is64bit && versionAtLeast version "5.9";
687+ in {
688+ KERNEL_XZ = mkIf (!useZstd) yes;
689+ KERNEL_ZSTD = mkIf useZstd yes;
690+
684691 HID_BATTERY_STRENGTH = yes;
685692 # enabled by default in x86_64 but not arm64, so we do that here
686693 HIDRAW = yes;
@@ -696,10 +703,6 @@ let
696703 MODULE_COMPRESS = yes;
697704 MODULE_COMPRESS_XZ = yes;
698705
699− # use zstd for kernel compression if newer than 5.9, else xz.
700− KERNEL_XZ = whenOlder "5.9" yes;
701− KERNEL_ZSTD = whenAtLeast "5.9" yes;
702−
703706 SYSVIPC = yes; # System-V IPC
704707
705708 AIO = yes; # POSIX asynchronous I/O