porcorosso: swap /root for a bindmount instead

This commit is contained in:
Luke Granger-Brown 2020-11-23 15:19:23 +00:00
parent 63c8b98893
commit 0f86867d05

View file

@ -201,17 +201,26 @@ in {
}; };
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
#"L /etc/nixos - - - - /persist/etc/nixos" #"L /etc/nixos - - - - /persist/etc/nixos"
"L /root - - - - /persist/root"
"d /var/lib/libvirt 0755 root - - -" "d /var/lib/libvirt 0755 root - - -"
]; ];
systemd.mounts = [{ systemd.mounts = let
bindsTo = ["libvirtd.service"]; bindMount' = dir: {
partOf = ["libvirtd.service"]; unitConfig.RequiresMountsFor = dir;
unitConfig.RequiresMountsFor = "/var/lib/libvirt"; options = "bind";
options = "bind"; what = "/persist${dir}";
what = "/persist/var/lib/libvirt"; where = dir;
where = "/var/lib/libvirt"; };
}]; 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. # Enable Thunderbolt device management.
services.hardware.bolt.enable = true; services.hardware.bolt.enable = true;