Added options to nfs share and root

This commit is contained in:
Nathan Anderson 2024-03-18 09:53:08 -06:00
parent 4f8c9c85aa
commit 3d71ee0bf8
2 changed files with 17 additions and 6 deletions

View File

@ -18,6 +18,8 @@
email = email; email = email;
sshEnable = true; sshEnable = true;
nfsEnable = true; nfsEnable = true;
nfsRoot = "/nfs_export";
nfsExports = [ "/kage" ];
}; };
# deskCfg = { # deskCfg = {

View File

@ -5,12 +5,12 @@ in
{ {
options.serverConfig= { options.serverConfig= {
userName = lib.mkOption { userName = lib.mkOption {
type = lib.types.str; type = lib.types.str;
description = "Main username for system"; description = "Main username for system";
}; };
hostName = lib.mkOption { hostName = lib.mkOption {
type = lib.types.str; type = lib.types.str;
description = "Hostname for system"; description = "Hostname for system";
}; };
hostId = lib.mkOption { hostId = lib.mkOption {
type = lib.types.str; type = lib.types.str;
@ -27,6 +27,14 @@ in
nfsEnable = lib.mkOption { nfsEnable = lib.mkOption {
default = false; 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 = [ imports = [
@ -73,8 +81,9 @@ in
services.nfs.server = lib.mkIf srvConfig.nfsEnable { services.nfs.server = lib.mkIf srvConfig.nfsEnable {
enable = true; enable = true;
exports = '' 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 ]; networking.firewall.allowedTCPPorts = [ 2049 ];