diff --git a/nix/modules/uki.nix b/nix/modules/uki.nix index e75093c..3b86d4d 100644 --- a/nix/modules/uki.nix +++ b/nix/modules/uki.nix @@ -17,46 +17,38 @@ in }; }; - config = - let - systemdUkify = pkgs.systemdMinimal.override { - withEfi = true; - withBootloader = true; - withUkify = true; - }; - in - lib.mkIf cfg.enable { - boot.bootspec.enable = true; - boot.loader.external = { - enable = true; - installHook = - let - bootspecNamespace = ''"org.nixos.bootspec.v1"''; - installer = pkgs.writeShellApplication { - name = "install-uki"; - runtimeInputs = with pkgs; [ jq systemd binutils ]; - text = '' - boot_json=/nix/var/nix/profiles/system-1-link/boot.json - kernel=$(jq -r '.${bootspecNamespace}.kernel' "$boot_json") - initrd=$(jq -r '.${bootspecNamespace}.initrd' "$boot_json") - init=$(jq -r '.${bootspecNamespace}.init' "$boot_json") + config = lib.mkIf cfg.enable { + boot.bootspec.enable = true; + boot.loader.external = { + enable = true; + installHook = + let + bootspecNamespace = ''"org.nixos.bootspec.v1"''; + installer = pkgs.writeShellApplication { + name = "install-uki"; + runtimeInputs = with pkgs; [ jq systemd binutils ]; + text = '' + boot_json=/nix/var/nix/profiles/system-1-link/boot.json + kernel=$(jq -r '.${bootspecNamespace}.kernel' "$boot_json") + initrd=$(jq -r '.${bootspecNamespace}.initrd' "$boot_json") + init=$(jq -r '.${bootspecNamespace}.init' "$boot_json") - ${systemdUkify}/lib/systemd/ukify \ - "$kernel" \ - "$initrd" \ - --stub=${cfg.stub} \ - --cmdline="init=$init ${builtins.toString config.boot.kernelParams}" \ - --os-release="@${config.system.build.etc}/etc/os-release" \ - --output=uki.efi + ${pkgs.systemdUkify}/lib/systemd/ukify \ + "$kernel" \ + "$initrd" \ + --stub=${cfg.stub} \ + --cmdline="init=$init ${builtins.toString config.boot.kernelParams}" \ + --os-release="@${config.system.build.etc}/etc/os-release" \ + --output=uki.efi - esp=${config.boot.loader.efi.efiSysMountPoint} + esp=${config.boot.loader.efi.efiSysMountPoint} - bootctl install --esp-path="$esp" - install uki.efi "$esp"/EFI/Linux/ - ''; - }; - in - "${installer}/bin/install-uki"; - }; + bootctl install --esp-path="$esp" + install uki.efi "$esp"/EFI/Linux/ + ''; + }; + in + "${installer}/bin/install-uki"; }; + }; }