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 = [
#"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";
systemd.mounts = let
bindMount' = dir: {
unitConfig.RequiresMountsFor = dir;
options = "bind";
what = "/persist/var/lib/libvirt";
where = "/var/lib/libvirt";
}];
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;