Added options to nfs share and root
This commit is contained in:
		
							parent
							
								
									4f8c9c85aa
								
							
						
					
					
						commit
						3d71ee0bf8
					
				@ -18,6 +18,8 @@
 | 
			
		||||
    email = email;
 | 
			
		||||
    sshEnable = true;
 | 
			
		||||
    nfsEnable = true;
 | 
			
		||||
    nfsRoot = "/nfs_export";
 | 
			
		||||
    nfsExports = [ "/kage" ];
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  # deskCfg = {
 | 
			
		||||
 | 
			
		||||
@ -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 ];
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user