From acca9fbf50cd79ef6a23e6d617b847bbde558715 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Sun, 1 Feb 2026 11:35:58 -0600 Subject: [PATCH] fix mounting --- flake/default-vm/flake.nix | 59 +++++++------------------------------- 1 file changed, 10 insertions(+), 49 deletions(-) diff --git a/flake/default-vm/flake.nix b/flake/default-vm/flake.nix index c5309f6..f0d6d68 100644 --- a/flake/default-vm/flake.nix +++ b/flake/default-vm/flake.nix @@ -138,34 +138,36 @@ # virtiofs mount points for caches (must match qvm virtiofsd mount tags) # Using virtiofs instead of 9p for better performance and hot-mount support + # Note: We use fileSystems with x-systemd options for proper ordering + # The mount waits for multi-user.target to ensure virtio-fs devices are ready fileSystems."/cache/cargo" = { device = "cargo_home"; fsType = "virtiofs"; - options = [ "nofail" ]; + options = [ "nofail" "x-systemd.automount" "x-systemd.idle-timeout=60" ]; }; fileSystems."/cache/target" = { device = "cargo_target"; fsType = "virtiofs"; - options = [ "nofail" ]; + options = [ "nofail" "x-systemd.automount" "x-systemd.idle-timeout=60" ]; }; fileSystems."/cache/pnpm" = { device = "pnpm_store"; fsType = "virtiofs"; - options = [ "nofail" ]; + options = [ "nofail" "x-systemd.automount" "x-systemd.idle-timeout=60" ]; }; fileSystems."/cache/sccache" = { device = "sccache"; fsType = "virtiofs"; - options = [ "nofail" ]; + options = [ "nofail" "x-systemd.automount" "x-systemd.idle-timeout=60" ]; }; fileSystems."/root/.config/opencode" = { device = "opencode_config"; fsType = "virtiofs"; - options = [ "nofail" ]; + options = [ "nofail" "x-systemd.automount" "x-systemd.idle-timeout=60" ]; }; # Environment variables for cache directories @@ -186,50 +188,9 @@ "d /cache/sccache 0755 root root -" ]; - # Systemd mount units for cache directories using virtiofs - # virtiofs provides better performance than 9p and supports hot-mounting - systemd.mounts = [ - { - what = "cargo_home"; - where = "/cache/cargo"; - type = "virtiofs"; - options = "nofail"; - wantedBy = [ "multi-user.target" ]; - after = [ "systemd-modules-load.service" ]; - } - { - what = "cargo_target"; - where = "/cache/target"; - type = "virtiofs"; - options = "nofail"; - wantedBy = [ "multi-user.target" ]; - after = [ "systemd-modules-load.service" ]; - } - { - what = "pnpm_store"; - where = "/cache/pnpm"; - type = "virtiofs"; - options = "nofail"; - wantedBy = [ "multi-user.target" ]; - after = [ "systemd-modules-load.service" ]; - } - { - what = "sccache"; - where = "/cache/sccache"; - type = "virtiofs"; - options = "nofail"; - wantedBy = [ "multi-user.target" ]; - after = [ "systemd-modules-load.service" ]; - } - { - what = "opencode_config"; - where = "/root/.config/opencode"; - type = "virtiofs"; - options = "nofail"; - wantedBy = [ "multi-user.target" ]; - after = [ "systemd-modules-load.service" ]; - } - ]; + # NOTE: Mount configuration is handled via fileSystems above with x-systemd.automount + # This provides on-demand mounting when the directory is first accessed, + # avoiding timing issues with virtiofs device availability at boot # Essential packages for development environment.systemPackages = with pkgs; [