nixos/hosts/common/optional/fileserver-nfs-mount.nix

28 lines
573 B
Nix
Raw Normal View History

2024-05-15 21:46:48 +01:00
{...}:
{
2024-05-16 11:55:24 +01:00
fileSystems."/exports" = {
device = "/dev/vdb1";
2024-05-15 21:46:48 +01:00
fsType = "ext4";
};
services.nfs.server = {
enable = true;
2024-05-16 11:55:24 +01:00
# fixed rpc.statd port; for firewall
lockdPort = 4001;
mountdPort = 4002;
statdPort = 4000;
extraNfsdConfig = '''';
2024-05-15 21:46:48 +01:00
exports = ''
2024-05-16 11:55:24 +01:00
/exports *(rw,insecure,all_squash)
2024-05-15 21:46:48 +01:00
'';
};
2024-05-16 11:55:24 +01:00
# 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 ];
};
2024-05-15 21:46:48 +01:00
}