Skip to content

Commit 9edff5c

Browse files
committed
desktops: nfs mount /services, /remote, ~/remote
- /services and /remote are mounted with nfs - ~/remote is bind mounted to the remote home directory in /remote on login with pam_mount ocf.nfs: - new ocf.nfs.mountRemote - fix incorrect "lib.mkIf cfg.mountHome" -> "lib.mkIf cfg.mountServices" for filesystems."/services"
1 parent de2b5d1 commit 9edff5c

2 files changed

Lines changed: 29 additions & 3 deletions

File tree

modules/nfs.nix

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ in
1818
default = false;
1919
};
2020

21+
mountRemote = lib.mkOption {
22+
type = lib.types.bool;
23+
description = "Mount NFS homes to /remote (for desktops which create home directory in tmpfs on login).";
24+
default = false;
25+
};
26+
2127
mountServices = lib.mkOption {
2228
type = lib.types.bool;
2329
description = "Mount /services from NFS.";
@@ -40,7 +46,19 @@ in
4046
];
4147
};
4248

43-
fileSystems."/services" = lib.mkIf cfg.mountHome {
49+
fileSystems."/remote" = lib.mkIf cfg.mountRemote {
50+
device = "homes:/home";
51+
fsType = "nfs4";
52+
options = [
53+
"rw"
54+
"bg"
55+
"noatime"
56+
"nodev"
57+
"nosuid"
58+
];
59+
};
60+
61+
fileSystems."/services" = lib.mkIf cfg.mountServices {
4462
device = "services:/services";
4563
fsType = "nfs4";
4664
options = [

profiles/desktop.nix

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,15 @@ in
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+
mountRemote = true;
46+
};
3947

4048
graphical.enable = true;
4149
graphical.extra = true;
@@ -63,7 +71,7 @@ in
6371
services.login.rules.session.mount.order =
6472
config.security.pam.services.login.rules.session.krb5.order + 50;
6573
mount.extraVolumes = [
66-
''<volume fstype="fuse" path="${lib.getExe sshfs}#%(USER)@tsunami:" mountpoint="~/remote/" options="follow_symlinks,UserKnownHostsFile=/dev/null,StrictHostKeyChecking=no" pgrp="ocf" />''
74+
''<volume fstype="bind" path="/remote/$(USER:0:1)/$(USER:0:2)/$(USER)" mountpoint="$(HOME)/remote/" />''
6775
];
6876

6977
# Trim spaces from username

0 commit comments

Comments
 (0)