diff --git a/hosts/common/optional/fileserver/nfs-server/homeshare.nix b/hosts/common/optional/fileserver/nfs-server/homeshare.nix index 902fe04..b6165dc 100644 --- a/hosts/common/optional/fileserver/nfs-server/homeshare.nix +++ b/hosts/common/optional/fileserver/nfs-server/homeshare.nix @@ -1,8 +1,40 @@ -{ - fileSystems."/media/homeshare" = { - device = "10.0.10.30:/mnt/homeshare"; - fsType = "nfs"; - options = [ "noatime" "_netdev" ]; +{configVars, ...}: +let + homeshareDataLocation = configVars.locations.homeshareDataLocation; +in { + fileSystems."/srv/export/photos" = { + device = "${homeshareDataLocation}/photos"; + options = [ "bind" ]; + }; + + fileSystems."/srv/export/personal" = { + device = "${homeshareDataLocation}/personal"; + options = [ "bind" ]; + }; + + fileSystems."/srv/export/media" = { + device = "${homeshareDataLocation}/media"; + options = [ "bind" ]; + }; + services.nfs.server = { + enable = true; + # fixed rpc.statd port; for firewall + lockdPort = 4001; + mountdPort = 4002; + statdPort = 4000; + extraNfsdConfig = ''''; + exports = '' + /srv/export/photos 192.10.99.0/24(rw,sync,no_subtree_check) 10.0.10.0/24(rw,sync,no_subtree_check) + /srv/export/media 192.10.99.0/24(rw,sync,no_subtree_check) 10.0.10.0/24(rw,sync,no_subtree_check) + /srv/export/personal 192.10.99.0/24(rw,sync,no_subtree_check) 10.0.10.0/24(rw,sync,no_subtree_check) + ''; + }; + # open nfs ports + networking.firewall = { + enable = true; + # for NFSv3; view with `rpcinfo -p` + allowedTCPPorts = [ 111 2049 4000 4001 4002 20048 ]; + allowedUDPPorts = [ 111 2049 4000 4001 4002 20048 ]; }; } diff --git a/hosts/common/optional/fileserver/nfs-server/media.nix b/hosts/common/optional/fileserver/nfs-server/media.nix deleted file mode 100644 index 7375f95..0000000 --- a/hosts/common/optional/fileserver/nfs-server/media.nix +++ /dev/null @@ -1,9 +0,0 @@ -{configVars, ...}: let - mediaDataMountPoint = configVars.locations.mediaDataMountPoint; -in { - fileSystems.${mediaDataMountPoint} = { - device = "10.0.10.30:/mnt/media"; - fsType = "nfs"; - options = ["noatime" "_netdev"]; - }; -} diff --git a/hosts/common/optional/fileserver/nfs-server/photos.nix b/hosts/common/optional/fileserver/nfs-server/photos.nix deleted file mode 100644 index 13cad9f..0000000 --- a/hosts/common/optional/fileserver/nfs-server/photos.nix +++ /dev/null @@ -1,9 +0,0 @@ -{configVars, ...}: let - photosDataMountPoint = configVars.locations.photosDataMountPoint; -in { - fileSystems.${photosDataMountPoint} = { - device = "10.0.10.30:/mnt/photos"; - fsType = "nfs"; - options = ["noatime" "_netdev" "ro"]; - }; -}