temmie/nfs-mounts: generate systemd units ourselves
Some checks failed
Eval nix flake / evals (push) Failing after 3m7s
Build topology graph / evals (push) Successful in 3m22s

This commit is contained in:
2026-01-22 17:10:04 +09:00
parent 1d47409d96
commit a54a560444

View File

@@ -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";
};
});
}