diff --git a/nixos/boxes/home/palace/vms/sfh/default.nix b/nixos/boxes/home/palace/vms/sfh/default.nix index 92123ba..011c4fd 100644 --- a/nixos/boxes/home/palace/vms/sfh/default.nix +++ b/nixos/boxes/home/palace/vms/sfh/default.nix @@ -71,6 +71,8 @@ in }; }; + networking = { inherit domain; }; + services = { lvm = { boot.thin.enable = true; diff --git a/nixos/modules/netboot/default.nix b/nixos/modules/netboot/default.nix index bc5fd1d..b74c7b7 100644 --- a/nixos/modules/netboot/default.nix +++ b/nixos/modules/netboot/default.nix @@ -56,6 +56,41 @@ in config = mkMerge [ (mkIf cfg.client.enable { + systemd = { + services = { + mount-boot = { + description = "Mount /boot"; + after = [ "systemd-networkd-wait-online.service" ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + }; + path = with pkgs; [ gnused ldns nfs-utils ]; + script = '' + get_cmdline() { + sed -rn "s/^.*$1=(\\S+).*\$/\\1/p" < /proc/cmdline + } + + host="$(get_cmdline boothost)" + if [ -z "$host" ]; then + echo "boothost kernel parameter not found!" >&2 + exit 1 + fi + + until [ -n "$(drill -Q $host)" ]; do + sleep 0.1 + done + + mkdir -p /boot + mount.nfs $host:/srv/netboot/systems/${config.system.name} /boot + ''; + + wantedBy = [ "remote-fs.target" ]; + }; + }; + }; + + boot.supportedFilesystems.nfs = true; boot.loader = { grub.enable = false; systemd-boot.enable = false;