From ccff74953242cf66ac72bc6268148d4421586aba Mon Sep 17 00:00:00 2001 From: WilliButz Date: Tue, 30 Jan 2024 23:43:17 +0100 Subject: [PATCH] nixos/boot.uki: allow partial overrides of default UKI settings Previously any user-provided config for boot.uki.settings would need to either specify a full set of config for ukify or a combination of mkOptionDefault to merge the "settings" attribute set with the module's defaults and then mkOverride or mkForce to override a contained attribute. Now it is possible to trivially override parts of the module's default config, such as the initrd or kernel command line, but overriding the full set of settings now requires mkOverride / mkForce. --- nixos/modules/system/boot/uki.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/nixos/modules/system/boot/uki.nix b/nixos/modules/system/boot/uki.nix index 63c4e0c0e391..63a7cbc5967b 100644 --- a/nixos/modules/system/boot/uki.nix +++ b/nixos/modules/system/boot/uki.nix @@ -51,16 +51,16 @@ in else "nixos"); - boot.uki.settings = lib.mkOptionDefault { + boot.uki.settings = { UKI = { - Linux = "${config.boot.kernelPackages.kernel}/${config.system.boot.loader.kernelFile}"; - Initrd = "${config.system.build.initialRamdisk}/${config.system.boot.loader.initrdFile}"; - Cmdline = "init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}"; - Stub = "${pkgs.systemd}/lib/systemd/boot/efi/linux${efiArch}.efi.stub"; - Uname = "${config.boot.kernelPackages.kernel.modDirVersion}"; - OSRelease = "@${config.system.build.etc}/etc/os-release"; + Linux = lib.mkOptionDefault "${config.boot.kernelPackages.kernel}/${config.system.boot.loader.kernelFile}"; + Initrd = lib.mkOptionDefault "${config.system.build.initialRamdisk}/${config.system.boot.loader.initrdFile}"; + Cmdline = lib.mkOptionDefault "init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}"; + Stub = lib.mkOptionDefault "${pkgs.systemd}/lib/systemd/boot/efi/linux${efiArch}.efi.stub"; + Uname = lib.mkOptionDefault "${config.boot.kernelPackages.kernel.modDirVersion}"; + OSRelease = lib.mkOptionDefault "@${config.system.build.etc}/etc/os-release"; # This is needed for cross compiling. - EFIArch = efiArch; + EFIArch = lib.mkOptionDefault efiArch; }; };