temmie/nfs-mounts: generate systemd units ourselves
This commit is contained in:
@@ -1,21 +1,31 @@
|
||||
{ pkgs, lib, ... }:
|
||||
let
|
||||
# See microbel:/etc/exports
|
||||
letters = [ "a" "b" "c" "d" "h" "i" "j" "k" "l" "m" "z" ];
|
||||
in
|
||||
{
|
||||
fileSystems = let
|
||||
# See microbel:/etc/exports
|
||||
shorthandAreas = lib.listToAttrs (map
|
||||
(l: lib.nameValuePair "/run/pvv-home-mounts/${l}" "homepvv${l}.pvv.ntnu.no:/export/home/pvv/${l}")
|
||||
[ "a" "b" "c" "d" "h" "i" "j" "k" "l" "m" "z" ]);
|
||||
in { }
|
||||
//
|
||||
(lib.mapAttrs (_: device: {
|
||||
inherit device;
|
||||
fsType = "nfs";
|
||||
options = [
|
||||
"nfsvers=3"
|
||||
"noauto"
|
||||
"proto=tcp"
|
||||
"x-systemd.automount"
|
||||
"x-systemd.idle-timeout=300"
|
||||
];
|
||||
}) shorthandAreas);
|
||||
systemd.mounts = lib.genAttrs' letters (l: {
|
||||
name = "run-pvv-home-mounts-${l}";
|
||||
value = {
|
||||
description = "PVV Homedirs Partition ${l}";
|
||||
type = "nfs";
|
||||
what = "homepvv${l}.pvv.ntnu.no:/export/home/pvv/${l}";
|
||||
where = "/run/pvv-home-mounts/${l}";
|
||||
before = [ "remote-fs.target" ];
|
||||
options = [
|
||||
"nfsvers=3"
|
||||
"noauto"
|
||||
"proto=tcp"
|
||||
];
|
||||
};
|
||||
});
|
||||
|
||||
systemd.automounts = lib.genAttrs' letters (l: {
|
||||
name = "run-pvv-home-mounts-${l}";
|
||||
value = {
|
||||
description = "PVV Homedirs Partition ${l}";
|
||||
where = "/run/pvv-home-mounts/${l}";
|
||||
automountConfig.TimeoutIdleSec = "5min";
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user