From 7c6f64914f37903ec3af2ac98ff3fafa970a1d5b Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Thu, 4 Jan 2024 02:42:03 +0100 Subject: system/activation/bootspec: do not synthesize `initrdSecrets` if unneeded We should not always create an appender script if we have no secret, this has no usefulness whatsover. --- nixos/modules/system/activation/bootspec.nix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'nixos/modules/system/activation/bootspec.nix') diff --git a/nixos/modules/system/activation/bootspec.nix b/nixos/modules/system/activation/bootspec.nix index 98c234bc340d0..2ed6964b2a6a6 100644 --- a/nixos/modules/system/activation/bootspec.nix +++ b/nixos/modules/system/activation/bootspec.nix @@ -11,6 +11,7 @@ let cfg = config.boot.bootspec; children = lib.mapAttrs (childName: childConfig: childConfig.configuration.system.build.toplevel) config.specialisation; + hasAtLeastOneInitrdSecret = lib.length (lib.attrNames config.boot.initrd.secrets) > 0; schemas = { v1 = rec { filename = "boot.json"; @@ -27,6 +28,7 @@ let label = "${config.system.nixos.distroName} ${config.system.nixos.codeName} ${config.system.nixos.label} (Linux ${config.boot.kernelPackages.kernel.modDirVersion})"; } // lib.optionalAttrs config.boot.initrd.enable { initrd = "${config.system.build.initialRamdisk}/${config.system.boot.loader.initrdFile}"; + } // lib.optionalAttrs hasAtLeastOneInitrdSecret { initrdSecrets = "${config.system.build.initialRamdiskSecretAppender}/bin/append-initrd-secrets"; }; })); -- cgit 1.4.1