From e641a643afdea9e769113d1d655d5bad14e37c22 Mon Sep 17 00:00:00 2001 From: Gabe Venberg Date: Thu, 23 May 2024 10:30:28 -0500 Subject: [PATCH] added an nfsv2 module. --- hosts/workstation-vm/default.nix | 7 +++++++ modules/nixos/nfsv2.nix | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 modules/nixos/nfsv2.nix diff --git a/hosts/workstation-vm/default.nix b/hosts/workstation-vm/default.nix index a517e9f..b411ee7 100644 --- a/hosts/workstation-vm/default.nix +++ b/hosts/workstation-vm/default.nix @@ -19,10 +19,12 @@ inputs.nixpkgs.lib.nixosSystem { ../../modules/nixos/printing.nix ../../modules/both/sound.nix ../../modules/nixos/networking.nix + ../../modules/nixos/nfsv2.nix ../../modules/both/i3 ({ config, pkgs, + lib, ... }: { host = { @@ -85,6 +87,11 @@ inputs.nixpkgs.lib.nixosSystem { # Enable the OpenSSH daemon. services.openssh.enable = true; + services.nfs.server = { + enable = true; + exports = "/srv/nfs *(rw,sync,no_root_squash,no_subtree_check)"; + }; + # Bootloader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; diff --git a/modules/nixos/nfsv2.nix b/modules/nixos/nfsv2.nix new file mode 100644 index 0000000..6b9eb4e --- /dev/null +++ b/modules/nixos/nfsv2.nix @@ -0,0 +1,23 @@ +{ + config, + pkgs, + lib, + ... +}: { + # will force you to compile kernel locally. + services.nfs = { + settings = { + nfsd.vers2 = true; + }; + server.enable = true; + }; + boot.kernelPatches = [ + { + name = "nfsv2"; + patch = null; + extraStructuredConfig = { + NFSD_V2 = lib.kernel.yes; + }; + } + ]; +}