nixos/netboot: Mount /boot
via kernel command line
This commit is contained in:
parent
f9870abc9e
commit
19fb29213e
@ -71,6 +71,8 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
networking = { inherit domain; };
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
lvm = {
|
lvm = {
|
||||||
boot.thin.enable = true;
|
boot.thin.enable = true;
|
||||||
|
@ -56,6 +56,41 @@ in
|
|||||||
|
|
||||||
config = mkMerge [
|
config = mkMerge [
|
||||||
(mkIf cfg.client.enable {
|
(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 = {
|
boot.loader = {
|
||||||
grub.enable = false;
|
grub.enable = false;
|
||||||
systemd-boot.enable = false;
|
systemd-boot.enable = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user