diff --git a/hosts/kyuubi/configuration.nix b/hosts/kyuubi/configuration.nix index 1e2b5c2..34b696e 100644 --- a/hosts/kyuubi/configuration.nix +++ b/hosts/kyuubi/configuration.nix @@ -14,6 +14,8 @@ in { # Define your hostname. networking.hostName = lib.mkForce "kyuubi"; + nfs.enable = true; + # environment.sessionVariables.FLAKE = "/home/${username}/Development/nix"; # Disable Autosuspend for USB Bluetooth dongles diff --git a/modules/nixos/services/nas/default.nix b/modules/nixos/services/nas/default.nix index a2a09f1..e8114d7 100644 --- a/modules/nixos/services/nas/default.nix +++ b/modules/nixos/services/nas/default.nix @@ -5,13 +5,13 @@ }: { imports = [ ./drives.nix + ./nfs.nix ]; - options = { - nas.enable = lib.mkEnableOption "NAS utilities and config"; - }; + options.nas.enable = lib.mkEnableOption "NAS utilities and config"; config = lib.mkIf config.nas.enable { drives.enable = lib.mkDefault true; + nfs.enable = lib.mkDefault false; }; } diff --git a/modules/nixos/services/nas/nfs.nix b/modules/nixos/services/nas/nfs.nix new file mode 100644 index 0000000..dbc9392 --- /dev/null +++ b/modules/nixos/services/nas/nfs.nix @@ -0,0 +1,24 @@ +{ + config, + lib, + ... +}: { + options.nfs.enable = lib.mkEnableOption "NFS Settings for Server and Client"; + + config = lib.mkIf config.nfs.enable { + services.nfs.server = { + enable = true; + # fixed rpc.statd port; for firewall + lockdPort = 4001; + mountdPort = 4002; + statdPort = 4000; + extraNfsdConfig = ''''; + }; + + networking.firewall = { + # for NFSv3; view with `rpcinfo -p` + allowedTCPPorts = [111 2049 4000 4001 4002 20048]; + allowedUDPPorts = [111 2049 4000 4001 4002 20048]; + }; + }; +}