diff --git a/ops/nixos/porcorosso/default.nix b/ops/nixos/porcorosso/default.nix index d9eb73ce05..5ebc769754 100644 --- a/ops/nixos/porcorosso/default.nix +++ b/ops/nixos/porcorosso/default.nix @@ -201,17 +201,26 @@ in { }; systemd.tmpfiles.rules = [ #"L /etc/nixos - - - - /persist/etc/nixos" - "L /root - - - - /persist/root" "d /var/lib/libvirt 0755 root - - -" ]; - systemd.mounts = [{ - bindsTo = ["libvirtd.service"]; - partOf = ["libvirtd.service"]; - unitConfig.RequiresMountsFor = "/var/lib/libvirt"; - options = "bind"; - what = "/persist/var/lib/libvirt"; - where = "/var/lib/libvirt"; - }]; + systemd.mounts = let + bindMount' = dir: { + unitConfig.RequiresMountsFor = dir; + options = "bind"; + what = "/persist${dir}"; + where = dir; + }; + bindMountSvc = dir: svc: (bindMount' dir) // { + bindsTo = [svc]; + partOf = [svc]; + }; + bindMount = dir: (bindMount' dir) // { + wantedBy = ["multi-user.target"]; + }; + in [ + (bindMountSvc "/var/lib/libvirt" "libvirtd.service") + (bindMount "/root") + ]; # Enable Thunderbolt device management. services.hardware.bolt.enable = true;