From 830dcbf6bc745bb154b1d8e5703f78134489eb5f Mon Sep 17 00:00:00 2001 From: Yureka Date: Sat, 3 Aug 2024 18:41:01 +0200 Subject: [PATCH] builders: do not mount / and /boot on netboot systems --- services/baremetal-builder/default.nix | 45 ++++++++++++++------------ 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/services/baremetal-builder/default.nix b/services/baremetal-builder/default.nix index 7f57d4d..89936ff 100644 --- a/services/baremetal-builder/default.nix +++ b/services/baremetal-builder/default.nix @@ -55,29 +55,34 @@ in boot.initrd.services.lvm.enable = true; - fileSystems."/" = { - device = "/dev/disk/by-label/root"; - fsType = "xfs"; - }; - - fileSystems."/mnt" = { - device = "/dev/disk/by-label/hydra"; - fsType = "xfs"; - options = ["logbsize=256k"]; - }; boot.kernel.sysctl."fs.xfs.xfssyncd_centisecs" = "12000"; + fileSystems = lib.mkMerge [ + { + "/" = { + device = "/dev/disk/by-label/root"; + fsType = "xfs"; + }; - # We want the tmp filesystem on the same filesystem as the hydra store, so that builds can use reflinks - fileSystems."/tmp" = { - device = "/mnt/tmp"; - options = [ "bind" ]; - }; + "/boot" = { + device = "/dev/disk/by-label/BOOT"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + } + (lib.mkIf (!cfg.netboot) { + "/mnt" = { + device = "/dev/disk/by-label/hydra"; + fsType = "xfs"; + options = ["logbsize=256k"]; + }; - fileSystems."/boot" = { - device = "/dev/disk/by-label/BOOT"; - fsType = "vfat"; - options = [ "fmask=0022" "dmask=0022" ]; - }; + # We want the tmp filesystem on the same filesystem as the hydra store, so that builds can use reflinks + "/tmp" = { + device = "/mnt/tmp"; + options = [ "bind" ]; + }; + }) + ]; swapDevices = lib.optionals (!cfg.netboot) [ {