Create directories in /vault/home for tent users
Reviewed-by: Aleix Boné <abonerib@bsc.es>
This commit is contained in:
parent
be231b6d2d
commit
a43f856b53
@ -1,4 +1,4 @@
|
|||||||
{ config, pkgs, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
@ -50,4 +50,21 @@
|
|||||||
device = "/dev/disk/by-label/vault";
|
device = "/dev/disk/by-label/vault";
|
||||||
fsType = "ext4";
|
fsType = "ext4";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Make a /vault/$USER directory for each user.
|
||||||
|
systemd.services.create-vault-dirs = let
|
||||||
|
# Take only normal users in tent
|
||||||
|
users = lib.filterAttrs (_: v: v.isNormalUser) config.users.users;
|
||||||
|
commands = lib.concatLists (lib.mapAttrsToList
|
||||||
|
(_: user: [
|
||||||
|
"install -d -o ${user.name} -g ${user.group} -m 0711 /vault/home/${user.name}"
|
||||||
|
]) users);
|
||||||
|
script = pkgs.writeShellScript "create-vault-dirs.sh" (lib.concatLines commands);
|
||||||
|
in {
|
||||||
|
enable = true;
|
||||||
|
wants = [ "local-fs.target" ];
|
||||||
|
after = [ "local-fs.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig.ExecStart = script;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user