From a54a56044420ca1cd886cb3b08090cbb7ba25c18 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Thu, 22 Jan 2026 17:10:04 +0900 Subject: [PATCH] temmie/nfs-mounts: generate systemd units ourselves --- hosts/temmie/services/nfs-mounts.nix | 46 +++++++++++++++++----------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/hosts/temmie/services/nfs-mounts.nix b/hosts/temmie/services/nfs-mounts.nix index 125cc20..2551c39 100644 --- a/hosts/temmie/services/nfs-mounts.nix +++ b/hosts/temmie/services/nfs-mounts.nix @@ -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"; + }; + }); }