Commit fa96a8058e64

Vincent Demeester <vincent@sbr.pm>
2025-12-05 17:16:48
feat: Add NFS media sharing to aomi
- Enable seamless access to music, pictures, and videos from laptop - Optimize resource usage with automount and 10-minute idle timeout - Extend network storage infrastructure to aomi workstation Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent ba866c7
Changed files (2)
systems/aomi/extra.nix
@@ -27,6 +27,8 @@
 
   networking.firewall.enable = false;
 
+  boot.supportedFilesystems = [ "nfs" ];
+
   # TODO make it an option ? (otherwise I'll add it for all)
   users.users.vincent.linger = true;
 
systems/aomi/hardware.nix
@@ -45,4 +45,49 @@
 
   swapDevices = [ { device = "/dev/disk/by-uuid/24da6a46-cd28-4bff-9220-6f449e3bd8b5"; } ];
 
+  # NFS mounts from rhea
+  fileSystems."/net/rhea/music" = {
+    device = "rhea.sbr.pm:/music"; # NFSv4: path relative to fsid=0 (/neo)
+    fsType = "nfs";
+    options = [
+      "nfsvers=4.2" # Use NFSv4.2 for best performance
+      "x-systemd.automount" # Lazy-mount on first access
+      "noauto" # Don't mount at boot
+      "x-systemd.idle-timeout=600" # Auto-unmount after 10 min idle
+      "soft" # Don't hang if server unavailable
+      "timeo=14" # Timeout after 1.4s (14 * 0.1s)
+      "retrans=2" # Retry twice before timing out
+      "_netdev" # Wait for network before mounting
+    ];
+  };
+
+  fileSystems."/net/rhea/pictures" = {
+    device = "rhea.sbr.pm:/pictures";
+    fsType = "nfs";
+    options = [
+      "nfsvers=4.2"
+      "x-systemd.automount"
+      "noauto"
+      "x-systemd.idle-timeout=600"
+      "soft"
+      "timeo=14"
+      "retrans=2"
+      "_netdev"
+    ];
+  };
+
+  fileSystems."/net/rhea/videos" = {
+    device = "rhea.sbr.pm:/videos";
+    fsType = "nfs";
+    options = [
+      "nfsvers=4.2"
+      "x-systemd.automount"
+      "noauto"
+      "x-systemd.idle-timeout=600"
+      "soft"
+      "timeo=14"
+      "retrans=2"
+      "_netdev"
+    ];
+  };
 }