forked from jan-leila/nix-config
		
	fixed nfs mounts
This commit is contained in:
		
							parent
							
								
									1c079fa479
								
							
						
					
					
						commit
						ca2b188560
					
				
					 5 changed files with 120 additions and 15 deletions
				
			
		|  | @ -57,7 +57,6 @@ nix multi user, multi system, configuration with `sops` secret management, `home | ||||||
| - auto turn off on power loss - nut | - auto turn off on power loss - nut | ||||||
| - zfs email after scrubbing # TODO: test this | - zfs email after scrubbing # TODO: test this | ||||||
| - SMART test with email results | - SMART test with email results | ||||||
| - fix nfs |  | ||||||
| - samba mounts | - samba mounts | ||||||
| - offline access for nfs mounts (overlay with rsync might be a good option here? https://www.spinics.net/lists/linux-unionfs/msg07105.html note about nfs4 and overlay fs) | - offline access for nfs mounts (overlay with rsync might be a good option here? https://www.spinics.net/lists/linux-unionfs/msg07105.html note about nfs4 and overlay fs) | ||||||
| - Create Tor guard/relay server | - Create Tor guard/relay server | ||||||
|  |  | ||||||
|  | @ -135,6 +135,85 @@ | ||||||
|     }; |     }; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|  |   # NFS support for mobile device - optimized for frequent disconnections | ||||||
|  |   boot.supportedFilesystems = ["nfs"]; | ||||||
|  | 
 | ||||||
|  |   fileSystems = { | ||||||
|  |     "/mnt/leyla_documents" = { | ||||||
|  |       device = "defiant:/exports/leyla_documents"; | ||||||
|  |       fsType = "nfs"; | ||||||
|  |       options = [ | ||||||
|  |         "x-systemd.automount" | ||||||
|  |         "noauto" | ||||||
|  |         "noatime" | ||||||
|  |         "nofail" | ||||||
|  |         "soft" | ||||||
|  |         "intr" # Allow interruption of NFS calls | ||||||
|  |         "timeo=30" # 3 second timeout (30 deciseconds) | ||||||
|  |         "retrans=2" # Only 2 retries before giving up | ||||||
|  |         "x-systemd.idle-timeout=300" # 5 minute idle timeout for mobile | ||||||
|  |         "x-systemd.device-timeout=15" # 15 second device timeout | ||||||
|  |         "bg" # Background mount - don't block boot | ||||||
|  |         "fsc" # Enable caching | ||||||
|  |         "_netdev" # Network device - wait for network | ||||||
|  |         "x-systemd.requires=network-online.target" # Require network to be online | ||||||
|  |         "x-systemd.after=network-online.target" # Start after network is online | ||||||
|  |         "x-systemd.mount-timeout=30" # 30 second mount timeout | ||||||
|  |       ]; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     "/mnt/users_documents" = { | ||||||
|  |       device = "defiant:/exports/users_documents"; | ||||||
|  |       fsType = "nfs"; | ||||||
|  |       options = [ | ||||||
|  |         "x-systemd.automount" | ||||||
|  |         "noauto" | ||||||
|  |         "nofail" | ||||||
|  |         "soft" | ||||||
|  |         "intr" | ||||||
|  |         "timeo=30" | ||||||
|  |         "retrans=2" | ||||||
|  |         "x-systemd.idle-timeout=300" | ||||||
|  |         "x-systemd.device-timeout=15" | ||||||
|  |         "bg" | ||||||
|  |         "fsc" | ||||||
|  |         "_netdev" | ||||||
|  |         "x-systemd.requires=network-online.target" | ||||||
|  |         "x-systemd.after=network-online.target" | ||||||
|  |         "x-systemd.mount-timeout=30" | ||||||
|  |       ]; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     "/mnt/media" = { | ||||||
|  |       device = "defiant:/exports/media"; | ||||||
|  |       fsType = "nfs"; | ||||||
|  |       options = [ | ||||||
|  |         "x-systemd.automount" | ||||||
|  |         "noauto" | ||||||
|  |         "noatime" | ||||||
|  |         "nofail" | ||||||
|  |         "soft" | ||||||
|  |         "intr" | ||||||
|  |         "timeo=30" | ||||||
|  |         "retrans=2" | ||||||
|  |         "x-systemd.idle-timeout=300" | ||||||
|  |         "x-systemd.device-timeout=15" | ||||||
|  |         "bg" | ||||||
|  |         # Mobile-optimized read settings | ||||||
|  |         "rsize=8192" # Smaller read size for mobile | ||||||
|  |         "wsize=8192" # Smaller write size for mobile | ||||||
|  |         "fsc" | ||||||
|  |         "_netdev" | ||||||
|  |         "x-systemd.requires=network-online.target" | ||||||
|  |         "x-systemd.after=network-online.target" | ||||||
|  |         "x-systemd.mount-timeout=30" | ||||||
|  |       ]; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  |   # Enable network-online.target for better network dependency handling | ||||||
|  |   systemd.services.NetworkManager-wait-online.enable = true; | ||||||
|  | 
 | ||||||
|   # Enable touchpad support (enabled default in most desktopManager). |   # Enable touchpad support (enabled default in most desktopManager). | ||||||
|   # services.xserver.libinput.enable = true; |   # services.xserver.libinput.enable = true; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -140,12 +140,20 @@ | ||||||
|       options = [ |       options = [ | ||||||
|         "x-systemd.automount" |         "x-systemd.automount" | ||||||
|         "noauto" |         "noauto" | ||||||
|         "user" |  | ||||||
|         "noatime" |         "noatime" | ||||||
|         "nofail" |         "nofail" | ||||||
|         "soft" |         "soft" | ||||||
|         "x-systemd.idle-timeout=600" |         "intr" # Allow interruption of NFS calls | ||||||
|         "fsc" |         "timeo=50" # 5 second timeout (50 deciseconds) - longer than mobile | ||||||
|  |         "retrans=3" # 3 retries for desktop | ||||||
|  |         "x-systemd.idle-timeout=600" # 10 minute idle timeout for desktop | ||||||
|  |         "x-systemd.device-timeout=30" # 30 second device timeout | ||||||
|  |         "bg" # Background mount - don't block boot | ||||||
|  |         "fsc" # Enable caching | ||||||
|  |         "_netdev" # Network device - wait for network | ||||||
|  |         "x-systemd.requires=network-online.target" # Require network to be online | ||||||
|  |         "x-systemd.after=network-online.target" # Start after network is online | ||||||
|  |         "x-systemd.mount-timeout=60" # 60 second mount timeout for desktop | ||||||
|       ]; |       ]; | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  | @ -155,11 +163,17 @@ | ||||||
|       options = [ |       options = [ | ||||||
|         "x-systemd.automount" |         "x-systemd.automount" | ||||||
|         "noauto" |         "noauto" | ||||||
|         "user" |  | ||||||
|         "nofail" |         "nofail" | ||||||
|         "soft" |         "soft" | ||||||
|  |         "intr" | ||||||
|  |         "timeo=50" | ||||||
|  |         "retrans=3" | ||||||
|         "x-systemd.idle-timeout=600" |         "x-systemd.idle-timeout=600" | ||||||
|  |         "bg" | ||||||
|         "fsc" |         "fsc" | ||||||
|  |         "_netdev" | ||||||
|  |         "x-systemd.requires=network-online.target" | ||||||
|  |         "x-systemd.after=network-online.target" | ||||||
|       ]; |       ]; | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  | @ -169,21 +183,30 @@ | ||||||
|       options = [ |       options = [ | ||||||
|         "x-systemd.automount" |         "x-systemd.automount" | ||||||
|         "noauto" |         "noauto" | ||||||
|         "user" |  | ||||||
|         "noatime" |         "noatime" | ||||||
|         "nofail" |         "nofail" | ||||||
|         "soft" |         "soft" | ||||||
|  |         "intr" | ||||||
|  |         "timeo=50" | ||||||
|  |         "retrans=3" | ||||||
|         "x-systemd.idle-timeout=600" |         "x-systemd.idle-timeout=600" | ||||||
|         "noatime" |         "x-systemd.device-timeout=30" | ||||||
|         "nodiratime" |         "bg" | ||||||
|         "relatime" |         # Desktop-optimized read settings | ||||||
|         "rsize=32768" |         "rsize=32768" # Larger read size for desktop | ||||||
|         "wsize=32768" |         "wsize=32768" # Larger write size for desktop | ||||||
|         "fsc" |         "fsc" | ||||||
|  |         "_netdev" | ||||||
|  |         "x-systemd.requires=network-online.target" | ||||||
|  |         "x-systemd.after=network-online.target" | ||||||
|  |         "x-systemd.mount-timeout=60" | ||||||
|       ]; |       ]; | ||||||
|     }; |     }; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|  |   # Enable network-online.target for better network dependency handling | ||||||
|  |   systemd.services.NetworkManager-wait-online.enable = true; | ||||||
|  | 
 | ||||||
|   environment.systemPackages = with pkgs; [ |   environment.systemPackages = with pkgs; [ | ||||||
|     cachefilesd |     cachefilesd | ||||||
|   ]; |   ]; | ||||||
|  |  | ||||||
|  | @ -15,7 +15,7 @@ in { | ||||||
|       export_directory = lib.mkOption { |       export_directory = lib.mkOption { | ||||||
|         type = lib.types.path; |         type = lib.types.path; | ||||||
|         description = "what are exports going to be stored in"; |         description = "what are exports going to be stored in"; | ||||||
|         default = "/export"; |         default = "/exports"; | ||||||
|       }; |       }; | ||||||
|       directories = lib.mkOption { |       directories = lib.mkOption { | ||||||
|         type = lib.types.listOf (lib.types.submodule ({config, ...}: { |         type = lib.types.listOf (lib.types.submodule ({config, ...}: { | ||||||
|  |  | ||||||
|  | @ -61,8 +61,6 @@ | ||||||
|                       # loopback |                       # loopback | ||||||
|                       "127.0.0.1" |                       "127.0.0.1" | ||||||
|                       "::1" |                       "::1" | ||||||
|                       # local network |  | ||||||
|                       # "192.168.0.0/24" |  | ||||||
|                       # tailscale |                       # tailscale | ||||||
|                       "100.64.0.0/10" |                       "100.64.0.0/10" | ||||||
|                       "fd7a:115c:a1e0::/48" |                       "fd7a:115c:a1e0::/48" | ||||||
|  | @ -84,7 +82,7 @@ | ||||||
|             ); |             ); | ||||||
|           }; |           }; | ||||||
|         }; |         }; | ||||||
|         networking.firewall.interfaces.${config.services.tailscale.interfaceName} = let |         networking.firewall = let | ||||||
|           ports = [ |           ports = [ | ||||||
|             111 |             111 | ||||||
|             config.host.network_storage.nfs.port |             config.host.network_storage.nfs.port | ||||||
|  | @ -94,6 +92,12 @@ | ||||||
|             20048 |             20048 | ||||||
|           ]; |           ]; | ||||||
|         in { |         in { | ||||||
|  |           # Allow NFS on Tailscale interface | ||||||
|  |           interfaces.${config.services.tailscale.interfaceName} = { | ||||||
|  |             allowedTCPPorts = ports; | ||||||
|  |             allowedUDPPorts = ports; | ||||||
|  |           }; | ||||||
|  |           # Allow NFS on local network (assuming default interface) | ||||||
|           allowedTCPPorts = ports; |           allowedTCPPorts = ports; | ||||||
|           allowedUDPPorts = ports; |           allowedUDPPorts = ports; | ||||||
|         }; |         }; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue