summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Hoang <enzime@users.noreply.github.com>2021-12-12 22:44:39 +1100
committerMichael Hoang <enzime@users.noreply.github.com>2021-12-23 11:44:29 +1100
commit13903fef2de2171d44e47c2c8d29eb194b614082 (patch)
treedbb3e2aaff69ddbba0337dc10fdcade3c709763a
parentf6b61981b16448315686a07707eca4acffe33fb4 (diff)
downloadnixpkgs-13903fef2de2171d44e47c2c8d29eb194b614082.tar
nixpkgs-13903fef2de2171d44e47c2c8d29eb194b614082.tar.gz
nixpkgs-13903fef2de2171d44e47c2c8d29eb194b614082.tar.bz2
nixpkgs-13903fef2de2171d44e47c2c8d29eb194b614082.tar.lz
nixpkgs-13903fef2de2171d44e47c2c8d29eb194b614082.tar.xz
nixpkgs-13903fef2de2171d44e47c2c8d29eb194b614082.tar.zst
nixpkgs-13903fef2de2171d44e47c2c8d29eb194b614082.zip
nixos/systemd-boot: Add option to add netboot.xyz
-rw-r--r--nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix34
1 files changed, 34 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix
index 0de3b74dd09..c07567ec82e 100644
--- a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix
+++ b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix
@@ -30,6 +30,8 @@ let
 
     memtest86 = if cfg.memtest86.enable then pkgs.memtest86-efi else "";
 
+    netbootxyz = if cfg.netbootxyz.enable then pkgs.netbootxyz-efi else "";
+
     copyExtraFiles = pkgs.writeShellScript "copy-extra-files" ''
       empty_file=$(mktemp)
 
@@ -151,6 +153,29 @@ in {
       };
     };
 
+    netbootxyz = {
+      enable = mkOption {
+        default = false;
+        type = types.bool;
+        description = ''
+          Make <literal>netboot.xyz</literal> available from the
+          <literal>systemd-boot</literal> menu. <literal>netboot.xyz</literal>
+          is a menu system that allows you to boot OS installers and
+          utilities over the network.
+        '';
+      };
+
+      entryFilename = mkOption {
+        default = "o_netbootxyz.conf";
+        type = types.str;
+        description = ''
+          <literal>systemd-boot</literal> orders the menu entries by the config file names,
+          so if you want something to appear after all the NixOS entries,
+          it should start with <filename>o</filename> or onwards.
+        '';
+      };
+    };
+
     extraEntries = mkOption {
       type = types.attrsOf types.lines;
       default = {};
@@ -245,6 +270,9 @@ in {
       (mkIf cfg.memtest86.enable {
         "efi/memtest86/BOOTX64.efi" = "${pkgs.memtest86-efi}/BOOTX64.efi";
       })
+      (mkIf cfg.netbootxyz.enable {
+        "efi/netbootxyz/netboot.xyz.efi" = "${pkgs.netbootxyz-efi}";
+      })
     ];
 
     boot.loader.systemd-boot.extraEntries = mkMerge [
@@ -254,6 +282,12 @@ in {
           efi    /efi/memtest86/BOOTX64.efi
         '';
       })
+      (mkIf cfg.netbootxyz.enable {
+        "${cfg.netbootxyz.entryFilename}" = ''
+          title  netboot.xyz
+          efi    /efi/netbootxyz/netboot.xyz.efi
+        '';
+      })
     ];
 
     system = {