Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wiki: NFS #13278

Closed
garbas opened this issue Feb 21, 2016 · 4 comments
Closed

wiki: NFS #13278

garbas opened this issue Feb 21, 2016 · 4 comments

Comments

@garbas
Copy link
Member

garbas commented Feb 21, 2016

https://nixos.org/wiki/NFS

@garbas garbas added this to the Move the wiki! milestone Feb 21, 2016
@aragnon
Copy link

aragnon commented Mar 16, 2016

@garbas This wiki entry contains a manual command mkdir /export. While the content is useful otherwise, it doesn't solve the NFS problem declaratively. Do you know how such a simple command should be turned into a Nix module? To me, it appears that all that needs to happen is that all the mount points need to be created by the NFS module via something like mkdir -p.

@DerTim1
Copy link

DerTim1 commented Sep 28, 2016

mkdir /exportisn't necessacry.mount` creates this directory.

fileSystems.NAME.options is now a list of strings, not a single string.

Firewall-Config is useful, if networking.firewall.enable = true is set:

  services.nfs.statdPort = 4000;
  services.nfs.lockdPort = 4001;
  networking.firewall.allowedTCPPorts = [ 2049 111 4000 4001 ];
  networking.firewall.allowedUDPPorts = [ 2049 111 4000 4001 ];

Sample Configuration:

{ config, pkgs, ... }:

{
  fileSystems."/nfs4exports/storage" = { 
    device = "/storage";
    options = [ "bind" ];
  };
  fileSystems."/nfs4exports/storage2" = { 
    device = "/storage2";
    options = [ "bind" ];
  };
    fileSystems."/nfs4exports/demoreadonly" = { 
    device = "/storage/demoreadonly";
    options = [ "bind" ];
  };

  services.nfs.server.enable = true;
  services.nfs.statdPort = 4000;
  services.nfs.lockdPort = 4001;
  services.nfs.server.exports = ''
  /nfs4exports          192.168.0.0/24(rw,fsid=0,no_subtree_check) 
  /nfs4exports/storage      192.168.0.0/24(rw,nohide,insecure,no_subtree_check) 
  /nfs4exports/storage2 192.168.0.0/24(rw,nohide,insecure,no_subtree_check) 
  /nfs4exports/demoreadonly     192.168.0.133(ro,nohide,insecure,no_subtree_check)
  '';

  networking.firewall.allowedTCPPorts = [ 2049 111 4000 4001 ];
  networking.firewall.allowedUDPPorts = [ 2049 111 4000 4001 ];
}

@garbas
Copy link
Member Author

garbas commented Sep 29, 2016

@DerTim1 you think this would be a nice addition to the services.nfs? to have an additional example there.

@DerTim1
Copy link

DerTim1 commented Sep 30, 2016

@garbas Yes, the current example (old wiki) is good enough with the fileSystems.NAME.options fix (list instead of single string) and an additonal hint to firewall-config. The pasted example works on my test machine (successfully imported the nfs mount with Ubuntu).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants