FEATURE: add nfs-server configuration

This commit is contained in:
Sam 2025-01-19 11:31:33 +00:00
parent 8d69a14fb6
commit 84d5521949
3 changed files with 37 additions and 23 deletions

View File

@ -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 ];
};
}

View File

@ -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"];
};
}

View File

@ -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"];
};
}