ifTheuExist and extra groups to user sam
This commit is contained in:
parent
74dab0c38d
commit
911d7d6905
|
@ -1,5 +1,6 @@
|
||||||
{ pkgs, inputs, config, lib, ... }:
|
{ pkgs, inputs, config, lib, ... }:
|
||||||
let
|
let
|
||||||
|
ifTheyExist = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups;
|
||||||
username = "admin";
|
username = "admin";
|
||||||
pubKeys = lib.filesystem.listFilesRecursive (../keys);
|
pubKeys = lib.filesystem.listFilesRecursive (../keys);
|
||||||
hostname = config.networking.hostName;
|
hostname = config.networking.hostName;
|
||||||
|
@ -15,7 +16,13 @@ in
|
||||||
hashedPasswordFile = sopsHashedPasswordFile;
|
hashedPasswordFile = sopsHashedPasswordFile;
|
||||||
openssh.authorizedKeys.keys = lib.lists.forEach pubKeys (key: builtins.readFile key);
|
openssh.authorizedKeys.keys = lib.lists.forEach pubKeys (key: builtins.readFile key);
|
||||||
|
|
||||||
extraGroups = ["wheel"];
|
extraGroups = [
|
||||||
|
"wheel"
|
||||||
|
] ++ ifTheyExist [
|
||||||
|
"docker"
|
||||||
|
"lxc"
|
||||||
|
"git"
|
||||||
|
];
|
||||||
|
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
];
|
];
|
||||||
|
@ -30,7 +37,7 @@ in
|
||||||
path = "/home/${username}/.ssh/id_ed25519";
|
path = "/home/${username}/.ssh/id_ed25519";
|
||||||
mode = "0600";
|
mode = "0600";
|
||||||
owner = "${username}";
|
owner = "${username}";
|
||||||
};
|
};
|
||||||
"ssh_keys/${username}/id_ed25519.pub" = {
|
"ssh_keys/${username}/id_ed25519.pub" = {
|
||||||
path = "/home/${username}/.ssh/id_ed25519.pub";
|
path = "/home/${username}/.ssh/id_ed25519.pub";
|
||||||
mode = "0644";
|
mode = "0644";
|
||||||
|
|
Loading…
Reference in New Issue