diff options
-rw-r--r-- | hel.nix | 49 | ||||
-rw-r--r-- | users/keys/gkleen-media-hel.pub (renamed from users/keys/gkleen-media@hel.pub) | 0 | ||||
-rw-r--r-- | vali.nix | 14 |
3 files changed, 59 insertions, 4 deletions
@@ -99,7 +99,20 @@ | |||
99 | HandleSuspendKey=sleep | 99 | HandleSuspendKey=sleep |
100 | ''; | 100 | ''; |
101 | 101 | ||
102 | openssh.enable = true; | 102 | openssh = { |
103 | enable = true; | ||
104 | extraConfig = '' | ||
105 | Match User media | ||
106 | ForceCommand internal-sftp | ||
107 | PermitTTY no | ||
108 | AllowTcpForwarding no | ||
109 | AllowStreamLocalForwarding no | ||
110 | X11Forwarding no | ||
111 | AllowAgentForwarding no | ||
112 | ChrootDirectory /run/%u | ||
113 | AuthorizedKeysFile /etc/ssh/authorized_keys.d/%u | ||
114 | ''; | ||
115 | }; | ||
103 | 116 | ||
104 | xserver = { | 117 | xserver = { |
105 | enable = true; | 118 | enable = true; |
@@ -238,10 +251,20 @@ | |||
238 | 251 | ||
239 | extraUsers.root = { inherit (import ./users/gkleen.nix) shell hashedPassword; }; | 252 | extraUsers.root = { inherit (import ./users/gkleen.nix) shell hashedPassword; }; |
240 | 253 | ||
254 | extraUsers.media = { | ||
255 | group = "media"; | ||
256 | home = "/var/media"; | ||
257 | isSystemUser = true; | ||
258 | openssh.authorizedKeys.keyFiles = [ | ||
259 | ./users/keys/gkleen-media-hel.pub | ||
260 | ]; | ||
261 | useDefaultShell = true; | ||
262 | }; | ||
263 | |||
241 | extraGroups = { | 264 | extraGroups = { |
242 | network = {}; | 265 | network = {}; |
243 | media = { | 266 | media = { |
244 | members = [ "gkleen" "uucp" ]; | 267 | members = [ "gkleen" "uucp" "media" ]; |
245 | }; | 268 | }; |
246 | networkmanager = { | 269 | networkmanager = { |
247 | members = [ "gkleen" ]; | 270 | members = [ "gkleen" ]; |
@@ -330,5 +353,27 @@ | |||
330 | virtualisation.virtualbox.host = { | 353 | virtualisation.virtualbox.host = { |
331 | enable = true; | 354 | enable = true; |
332 | }; | 355 | }; |
356 | |||
357 | systemd.automounts = [ | ||
358 | { enable = true; | ||
359 | where = "/run/media/var/media"; | ||
360 | automountConfig = { | ||
361 | DirectoryMode = "700"; | ||
362 | }; | ||
363 | wantedBy = [ "local-fs.target" ]; | ||
364 | } | ||
365 | ]; | ||
366 | |||
367 | systemd.mounts = [ | ||
368 | { enable = true; | ||
369 | where = "/run/media/var/media"; | ||
370 | what = "/var/media"; | ||
371 | type = "none"; | ||
372 | options = "bind"; | ||
373 | mountConfig = { | ||
374 | DirectoryMode = "700"; | ||
375 | }; | ||
376 | } | ||
377 | ]; | ||
333 | } | 378 | } |
334 | 379 | ||
diff --git a/users/keys/gkleen-media@hel.pub b/users/keys/gkleen-media-hel.pub index 064eaaf7..064eaaf7 100644 --- a/users/keys/gkleen-media@hel.pub +++ b/users/keys/gkleen-media-hel.pub | |||
@@ -55,6 +55,7 @@ rec { | |||
55 | tmux | 55 | tmux |
56 | mosh | 56 | mosh |
57 | ntfs3g | 57 | ntfs3g |
58 | sshfsFuse | ||
58 | ]; | 59 | ]; |
59 | 60 | ||
60 | # List services that you want to enable: | 61 | # List services that you want to enable: |
@@ -74,6 +75,8 @@ rec { | |||
74 | # services.xserver.displayManager.kdm.enable = true; | 75 | # services.xserver.displayManager.kdm.enable = true; |
75 | # services.xserver.desktopManager.kde4.enable = true; | 76 | # services.xserver.desktopManager.kde4.enable = true; |
76 | 77 | ||
78 | users.mutableUsers = false; | ||
79 | |||
77 | users.extraUsers.root = let | 80 | users.extraUsers.root = let |
78 | template = (import users/gkleen.nix); | 81 | template = (import users/gkleen.nix); |
79 | in { | 82 | in { |
@@ -81,6 +84,11 @@ rec { | |||
81 | openssh.authorizedKeys.keyFiles = template.openssh.authorizedKeys.keyFiles; | 84 | openssh.authorizedKeys.keyFiles = template.openssh.authorizedKeys.keyFiles; |
82 | }; | 85 | }; |
83 | 86 | ||
87 | users.extraGroups.media = { | ||
88 | gid = 498; | ||
89 | members = [ "gkleen" ]; | ||
90 | }; | ||
91 | |||
84 | system.activationScripts = let | 92 | system.activationScripts = let |
85 | setupUsers = pkgs.callPackage custom/dotfiles.nix {}; | 93 | setupUsers = pkgs.callPackage custom/dotfiles.nix {}; |
86 | toRec = name : { | 94 | toRec = name : { |
@@ -168,16 +176,18 @@ rec { | |||
168 | # automountConfig = { | 176 | # automountConfig = { |
169 | # DirectoryMode = "555"; | 177 | # DirectoryMode = "555"; |
170 | # }; | 178 | # }; |
179 | # wantedBy = [ "remote-fs.target" ]; | ||
171 | # } | 180 | # } |
172 | # ]; | 181 | # ]; |
173 | 182 | ||
174 | # systemd.mounts = [ | 183 | # systemd.mounts = [ |
175 | # { enable = true; | 184 | # { enable = true; |
176 | # where = "/var/media"; | 185 | # where = "/var/media"; |
177 | # what = "gkleen@hel.asgard.yggdrasil:/var/media"; | 186 | # what = "media@hel.asgard.yggdrasil:/var/media"; |
178 | # type = "fuse.sshfs"; | 187 | # type = "fuse.sshfs"; |
179 | # options = "users,idmap=gkleen,IdentityFile=/home/user/.ssh/id_ed25519,allow_other,reconnect,_netdev"; | 188 | # options = "idmap=user,IdentityFile=/home/gkleen/.ssh/media@hel,allow_other,reconnect,_netdev"; |
180 | # mountConfig = { | 189 | # mountConfig = { |
190 | # Environment = "PATH=/run/current-system/sw/bin:/run/current/system/sw/sbin"; | ||
181 | # DirectoryMode = "555"; | 191 | # DirectoryMode = "555"; |
182 | # }; | 192 | # }; |
183 | # } | 193 | # } |