host/home: add nfs server to share some dirs

This commit is contained in:
Dmitriy Pleshevskiy 2025-03-06 12:50:05 +03:00
parent 21ce9728f3
commit fa6cf08b3a
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2
2 changed files with 33 additions and 2 deletions
hosts/home/hardware-configuration

View file

@ -1,8 +1,10 @@
{ config, ... }:
{
# Include the results of the hardware scan.
imports = [ ./generated.nix ];
imports = [
./generated.nix # Include the results of the hardware scan.
./nfs.nix
];
# Add support of usb
boot.initrd.availableKernelModules = [ "usb_storage" ];

View file

@ -0,0 +1,29 @@
{ ... }:
{
fileSystems."/export/mynix" = {
device = "/home/jan/mynix";
options = [ "bind" ];
};
fileSystems."/export/projects" = {
device = "/home/jan/projects";
options = [ "bind" ];
};
services.nfs.server = {
enable = true;
lockdPort = 4001;
mountdPort = 4002;
statdPort = 4000;
exports = ''
/export 192.168.0.0/24(rw,fsid=0,no_subtree_check)
/export/mynix 192.168.0.0/24(rw,nohide,insecure,no_subtree_check)
/export/projects 192.168.0.0/24(rw,nohide,insecure,no_subtree_check)
'';
};
networking.firewall = {
allowedTCPPorts = [ 111 2049 4000 4001 4002 20048 ];
allowedUDPPorts = [ 111 2049 4000 4001 4002 20048 ];
};
}