From 13903fef2de2171d44e47c2c8d29eb194b614082 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Sun, 12 Dec 2021 22:44:39 +1100 Subject: nixos/systemd-boot: Add option to add netboot.xyz --- .../boot/loader/systemd-boot/systemd-boot.nix | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) 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 netboot.xyz available from the + systemd-boot menu. netboot.xyz + 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 = '' + systemd-boot 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 o 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 = { -- cgit 1.4.1