forked from jan-leila/nix-config
		
	added more config for nfs mounts
This commit is contained in:
		
							parent
							
								
									f5c67b812f
								
							
						
					
					
						commit
						1e98b54454
					
				
					 6 changed files with 27 additions and 10 deletions
				
			
		|  | @ -58,6 +58,7 @@ | ||||||
|           folder = "leyla"; |           folder = "leyla"; | ||||||
|           user = "leyla"; |           user = "leyla"; | ||||||
|           group = "leyla"; |           group = "leyla"; | ||||||
|  |           bind = "/home/leyla/documents"; | ||||||
|         } |         } | ||||||
|         { |         { | ||||||
|           folder = "eve"; |           folder = "eve"; | ||||||
|  | @ -69,6 +70,12 @@ | ||||||
|           user = "root"; |           user = "root"; | ||||||
|           group = "users"; |           group = "users"; | ||||||
|         } |         } | ||||||
|  |         { | ||||||
|  |           folder = "media"; | ||||||
|  |           user = "jellyfin"; | ||||||
|  |           group = "jellyfin_media"; | ||||||
|  |           bind = config.host.jellyfin.media_directory; | ||||||
|  |         } | ||||||
|       ]; |       ]; | ||||||
|       nfs = { |       nfs = { | ||||||
|         enable = true; |         enable = true; | ||||||
|  |  | ||||||
|  | @ -38,23 +38,29 @@ | ||||||
|       fsType = "vfat"; |       fsType = "vfat"; | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     "/mnt/leyla_home" = { |     "/mnt/leyla_documents" = { | ||||||
|       device = "defiant:/exports/leyla"; |       device = "defiant:/exports/leyla"; | ||||||
|       fsType = "nfs"; |       fsType = "nfs"; | ||||||
|       options = ["x-systemd.automount" "user" "noatime" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"]; |       options = ["x-systemd.automount" "user" "noatime" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"]; | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     "/mnt/eve_home" = { |     "/mnt/eve_documents" = { | ||||||
|       device = "defiant:/exports/eve"; |       device = "defiant:/exports/eve"; | ||||||
|       fsType = "nfs"; |       fsType = "nfs"; | ||||||
|       options = ["x-systemd.automount" "user" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"]; |       options = ["x-systemd.automount" "user" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"]; | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     "/mnt/users_home" = { |     "/mnt/users_documents" = { | ||||||
|       device = "defiant:/exports/users"; |       device = "defiant:/exports/users"; | ||||||
|       fsType = "nfs"; |       fsType = "nfs"; | ||||||
|       options = ["x-systemd.automount" "user" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"]; |       options = ["x-systemd.automount" "user" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"]; | ||||||
|     }; |     }; | ||||||
|  | 
 | ||||||
|  |     "/mnt/media" = { | ||||||
|  |       device = "defiant:/exports/media"; | ||||||
|  |       fsType = "nfs"; | ||||||
|  |       options = ["user" "noatime" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"]; | ||||||
|  |     }; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   environment.systemPackages = with pkgs; [ |   environment.systemPackages = with pkgs; [ | ||||||
|  |  | ||||||
|  | @ -47,13 +47,13 @@ | ||||||
|       options = ["fmask=0022" "dmask=0022"]; |       options = ["fmask=0022" "dmask=0022"]; | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     "/mnt/leyla_home" = { |     "/mnt/leyla_documents" = { | ||||||
|       device = "defiant:/exports/leyla"; |       device = "defiant:/exports/leyla"; | ||||||
|       fsType = "nfs"; |       fsType = "nfs"; | ||||||
|       options = ["x-systemd.automount" "user" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"]; |       options = ["x-systemd.automount" "user" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"]; | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     "/mnt/users_home" = { |     "/mnt/users_documents" = { | ||||||
|       device = "defiant:/exports/users"; |       device = "defiant:/exports/users"; | ||||||
|       fsType = "nfs"; |       fsType = "nfs"; | ||||||
|       options = ["x-systemd.automount" "user" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"]; |       options = ["x-systemd.automount" "user" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"]; | ||||||
|  |  | ||||||
|  | @ -7,7 +7,6 @@ | ||||||
|   jellyfinPort = 8096; |   jellyfinPort = 8096; | ||||||
|   jellyfin_data_directory = "/var/lib/jellyfin"; |   jellyfin_data_directory = "/var/lib/jellyfin"; | ||||||
|   jellyfin_cache_directory = "/var/cache/jellyfin"; |   jellyfin_cache_directory = "/var/cache/jellyfin"; | ||||||
|   jellyfin_media_directory = "/srv/jellyfin/media"; |  | ||||||
| in { | in { | ||||||
|   options.host.jellyfin = { |   options.host.jellyfin = { | ||||||
|     enable = lib.mkEnableOption "should jellyfin be enabled on this computer"; |     enable = lib.mkEnableOption "should jellyfin be enabled on this computer"; | ||||||
|  | @ -21,6 +20,11 @@ in { | ||||||
|       description = "ex subdomain of base domain that jellyfin will be hosted at"; |       description = "ex subdomain of base domain that jellyfin will be hosted at"; | ||||||
|       default = []; |       default = []; | ||||||
|     }; |     }; | ||||||
|  |     media_directory = lib.mkOption { | ||||||
|  |       type = lib.types.str; | ||||||
|  |       description = "directory jellyfin media will be hosted at"; | ||||||
|  |       default = "/srv/jellyfin/media"; | ||||||
|  |     }; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   config = lib.mkIf config.host.jellyfin.enable ( |   config = lib.mkIf config.host.jellyfin.enable ( | ||||||
|  | @ -126,7 +130,7 @@ in { | ||||||
|             hideMounts = true; |             hideMounts = true; | ||||||
|             directories = [ |             directories = [ | ||||||
|               { |               { | ||||||
|                 directory = jellyfin_media_directory; |                 directory = config.host.jellyfin.media_directory; | ||||||
|                 user = "jellyfin"; |                 user = "jellyfin"; | ||||||
|                 group = "jellyfin_media"; |                 group = "jellyfin_media"; | ||||||
|                 mode = "1770"; |                 mode = "1770"; | ||||||
|  |  | ||||||
|  | @ -57,7 +57,7 @@ in { | ||||||
|       # create any folders that we need to have for our exports |       # create any folders that we need to have for our exports | ||||||
|       systemd.tmpfiles.rules = |       systemd.tmpfiles.rules = | ||||||
|         [ |         [ | ||||||
|           "d ${config.host.network_storage.export_directory} 2770 root root -" |           "d ${config.host.network_storage.export_directory} 2775 root root -" | ||||||
|         ] |         ] | ||||||
|         ++ ( |         ++ ( | ||||||
|           builtins.map ( |           builtins.map ( | ||||||
|  |  | ||||||
|  | @ -38,8 +38,8 @@ | ||||||
|         services.nfs.server = { |         services.nfs.server = { | ||||||
|           enable = true; |           enable = true; | ||||||
|           exports = lib.strings.concatLines ( |           exports = lib.strings.concatLines ( | ||||||
|             builtins.map ( |             lib.lists.imap0 ( | ||||||
|               directory: "${directory._directory} 100.64.0.0/10(rw,sync,no_subtree_check,crossmnt)" |               i: directory: "${directory._directory} 100.64.0.0/10(rw,sync,no_subtree_check,crossmnt,fsid=${builtins.toString i})" | ||||||
|             ) |             ) | ||||||
|             ( |             ( | ||||||
|               builtins.filter ( |               builtins.filter ( | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue