diff --git a/luci/default.nix b/luci/default.nix index 52e3e37..a474c6a 100644 --- a/luci/default.nix +++ b/luci/default.nix @@ -18,6 +18,8 @@ email = email; sshEnable = true; nfsEnable = true; + nfsRoot = "/nfs_export"; + nfsExports = [ "/kage" ]; }; # deskCfg = { diff --git a/shared/server-configuration.nix b/shared/server-configuration.nix index 64477dc..6639b7e 100644 --- a/shared/server-configuration.nix +++ b/shared/server-configuration.nix @@ -5,12 +5,12 @@ in { options.serverConfig= { userName = lib.mkOption { - type = lib.types.str; - description = "Main username for system"; + type = lib.types.str; + description = "Main username for system"; }; hostName = lib.mkOption { - type = lib.types.str; - description = "Hostname for system"; + type = lib.types.str; + description = "Hostname for system"; }; hostId = lib.mkOption { type = lib.types.str; @@ -27,6 +27,14 @@ in nfsEnable = lib.mkOption { default = false; }; + nfsRoot = lib.mkOption { + default = "/nfs_export"; + type = lib.types.str; + }; + nfsExports = lib.mkOption { + default = []; + description = "List of file paths provided as strings to the nfs exports"; + }; }; imports = [ @@ -73,8 +81,9 @@ in services.nfs.server = lib.mkIf srvConfig.nfsEnable { enable = true; exports = '' - /kage 192.168.1.149(rw,fsid=0,no_subtree_check) - ''; + ${srvConfig.nfsRoot} 192.168.1.*(rw,fsid=root,no_subtree_check) + ${concatMapStringsSep "\n" (n: "${srvConfig.nfsRoot}${n} 192.168.1.*(rw,no_subtree_check,nohide)") srvConfig.nfsExports} + ''; }; networking.firewall.allowedTCPPorts = [ 2049 ];