about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorWilliButz <willibutz@posteo.de>2024-03-19 17:58:28 +0100
committerWilliButz <willibutz@posteo.de>2024-03-19 17:58:28 +0100
commite9fa0ec5fe1b29d34f7589bc59033b412e065687 (patch)
tree9cb8b38b6f304a9629f1425e6623783c8619140a /nixos
parent9a747326c4b37ce60918aeb4747322c538d921f1 (diff)
downloadnixlib-e9fa0ec5fe1b29d34f7589bc59033b412e065687.tar
nixlib-e9fa0ec5fe1b29d34f7589bc59033b412e065687.tar.gz
nixlib-e9fa0ec5fe1b29d34f7589bc59033b412e065687.tar.bz2
nixlib-e9fa0ec5fe1b29d34f7589bc59033b412e065687.tar.lz
nixlib-e9fa0ec5fe1b29d34f7589bc59033b412e065687.tar.xz
nixlib-e9fa0ec5fe1b29d34f7589bc59033b412e065687.tar.zst
nixlib-e9fa0ec5fe1b29d34f7589bc59033b412e065687.zip
nixos/uki: add configFile option
This option makes it easier to reuse a system's ukify.conf without the
need for manually calling the generator on `settings` again to receive a
rendered configuration file.

Theoretically, a complete configuration file could now be provided by
users.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/system/boot/uki.nix15
1 files changed, 12 insertions, 3 deletions
diff --git a/nixos/modules/system/boot/uki.nix b/nixos/modules/system/boot/uki.nix
index 0965b887c12e..c8d3c2f6605f 100644
--- a/nixos/modules/system/boot/uki.nix
+++ b/nixos/modules/system/boot/uki.nix
@@ -7,8 +7,6 @@ let
   inherit (pkgs.stdenv.hostPlatform) efiArch;
 
   format = pkgs.formats.ini { };
-  ukifyConfig = format.generate "ukify.conf" cfg.settings;
-
 in
 
 {
@@ -48,6 +46,15 @@ in
           contains and how it is built.
         '';
       };
+
+      configFile = lib.mkOption {
+        type = lib.types.path;
+        description = lib.mdDoc ''
+          The configuration file passed to {manpage}`ukify(1)` to create the UKI.
+
+          By default this configuration file is created from {option}`boot.uki.settings`.
+        '';
+      };
     };
 
     system.boot.loader.ukiFile = lib.mkOption {
@@ -80,6 +87,8 @@ in
       };
     };
 
+    boot.uki.configFile = lib.mkOptionDefault (format.generate "ukify.conf" cfg.settings);
+
     system.boot.loader.ukiFile =
       let
         name = config.boot.uki.name;
@@ -92,7 +101,7 @@ in
     system.build.uki = pkgs.runCommand config.system.boot.loader.ukiFile { } ''
       mkdir -p $out
       ${pkgs.buildPackages.systemdUkify}/lib/systemd/ukify build \
-        --config=${ukifyConfig} \
+        --config=${cfg.configFile} \
         --output="$out/${config.system.boot.loader.ukiFile}"
     '';