From a9803c7378bf4fc4917931d6f1c988306c473f3c Mon Sep 17 00:00:00 2001 From: Cryolitia PukNgae Date: Thu, 7 May 2026 10:59:05 +0800 Subject: [PATCH] nixos/kernel: only link initrd when enabled Avoid creating the initrd symlink for configurations with boot.initrd.enable = false. --- nixos/modules/system/boot/kernel.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix index 9a3138ff37eb..7f2d388b8af3 100644 --- a/nixos/modules/system/boot/kernel.nix +++ b/nixos/modules/system/boot/kernel.nix @@ -412,7 +412,9 @@ in echo -n "$kernelParams" > $out/kernel-params - ln -s ${initrdPath} $out/initrd + ${optionalString config.boot.initrd.enable '' + ln -s ${initrdPath} $out/initrd + ''} ${optionalString (config.boot.initrd.secrets != { }) '' ln -s ${config.system.build.initialRamdiskSecretAppender}/bin/append-initrd-secrets $out