From 9899ef251e1bd16bef58adbe30341fbcd9804d62 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Wed, 27 Jan 2021 21:26:19 -0500 Subject: [PATCH] netboot: add netboot build target --- lib/default.nix | 13 +++++++++++++ shell/default.nix | 6 +++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/default.nix b/lib/default.nix index 86d024232..455b4302d 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -77,11 +77,24 @@ in } ) ).config; + + netbootConfig = ( + import (nixos + "/nixos/lib/eval-config.nix") + ( + args // { + modules = modules ++ [ + (nixos + "/nixos/modules/installer/netboot/netboot.nix") + ]; + } + ) + ).config; in modules ++ [ { system.build = { iso = isoConfig.system.build.isoImage; + netbootRamdisk = netbootConfig.system.build.netbootRamdisk; + netbootIpxeScript = netbootConfig.system.build.netbootIpxeScript; }; } ]; diff --git a/shell/default.nix b/shell/default.nix index f65111524..401f9998f 100644 --- a/shell/default.nix +++ b/shell/default.nix @@ -12,7 +12,7 @@ let flk = pkgs.writeShellScriptBin "flk" '' if [[ -z "$1" ]]; then - echo "Usage: $(basename "$0") [ up | iso {host} | install {host} | {host} [switch|boot|test] | home {host} {user} [switch] ]" + echo "Usage: $(basename "$0") [ up | iso {host} | netboot-ramdisk {host} | netboot-ipxe {host} | install {host} | {host} [switch|boot|test] | home {host} {user} [switch] ]" elif [[ "$1" == "up" ]]; then mkdir -p $DEVSHELL_ROOT/up hostname=$(hostname) @@ -25,6 +25,10 @@ let git add -f $DEVSHELL_ROOT/hosts/up-$hostname.nix elif [[ "$1" == "iso" ]]; then nix build $DEVSHELL_ROOT#nixosConfigurations.$2.${build}.iso "${"\${@:3}"}" + elif [[ "$1" == "netboot-ramdisk" ]]; then + nix build $DEVSHELL_ROOT#nixosConfigurations.$2.${build}.netbootRamdisk "${"\${@:3}"}" + elif [[ "$1" == "netboot-ipxe" ]]; then + nix build $DEVSHELL_ROOT#nixosConfigurations.$2.${build}.netbootIpxeScript "${"\${@:3}"}" elif [[ "$1" == "install" ]]; then sudo nixos-install --flake "$DEVSHELL_ROOT#$2" "${"\${@:3}"}" elif [[ "$1" == "home" ]]; then