File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88let
99 cfg = config . ocf . nfs ;
10+
11+ # nix lazy evals so it should be fine to put it here
12+ homePath = if cfg . mountHome . asRemote then "/remote" else "/home" ;
1013in
1114{
1215 options . ocf . nfs = {
1821 default = false ;
1922 } ;
2023
24+ mountHome . asRemote = lib . mkOption {
25+ type = lib . types . bool ;
26+ description = "Mount homes from NFS to /remote instead of /home (for desktops which create home directory in tmpfs on login)." ;
27+ default = false ;
28+ } ;
29+
2130 mountServices = lib . mkOption {
2231 type = lib . types . bool ;
2332 description = "Mount /services from NFS." ;
2837 config = lib . mkIf cfg . enable {
2938 boot . supportedFilesystems = [ "nfs" ] ;
3039
31- fileSystems . "/home " = lib . mkIf cfg . mountHome {
40+ fileSystems . "${ homePath } " = lib . mkIf cfg . mountHome {
3241 device = "homes:/home" ;
3342 fsType = "nfs4" ;
3443 options = [
Original file line number Diff line number Diff line change 3535 tmpfsHome . enable = true ;
3636 network . wakeOnLan . enable = true ;
3737 logged-in-users-exporter . enable = true ;
38- nfs . enable = true ;
38+
39+ nfs = {
40+ enable = true ;
41+ mountServices = true ;
42+
43+ # we keep a single nfs mount and then bind mount to it instead of having
44+ # many nfs mounts (each logged in user would need a mount)
45+ mountHome = true ;
46+ mountHome . asRemote = true ;
47+ } ;
3948
4049 graphical . enable = true ;
4150 graphical . extra = true ;
6372 services . login . rules . session . mount . order =
6473 config . security . pam . services . login . rules . session . krb5 . order + 50 ;
6574 mount . extraVolumes = [
66- ''<volume fstype="fuse " path="${ lib . getExe sshfs } #% (USER)@tsunami: " mountpoint="~ /remote/" options="follow_symlinks,UserKnownHostsFile=/dev/null,StrictHostKeyChecking=no" pgrp="ocf " />''
75+ ''<volume fstype="bind " path="/remote/$ (USER:0:1)/$(USER:0:2)/$(USER) " mountpoint="$(HOME) /remote/" />''
6776 ] ;
6877
6978 # Trim spaces from username
You can’t perform that action at this time.
0 commit comments