modules: system: move 'users'
This commit is contained in:
parent
60f1e693d1
commit
3b9f01e780
5 changed files with 1 additions and 1 deletions
36
modules/system/users.nix
Normal file
36
modules/system/users.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# User setup
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
my = config.my;
|
||||
groupExists = grp: builtins.hasAttr grp config.users.groups;
|
||||
groupsIfExist = builtins.filter groupExists;
|
||||
in
|
||||
{
|
||||
users.mutableUsers = false; # I want it to be declarative.
|
||||
|
||||
# Define user accounts and passwords.
|
||||
users.users.root.hashedPassword = my.secrets.users.root.hashedPassword;
|
||||
users.users.ambroisie = {
|
||||
hashedPassword = my.secrets.users.ambroisie.hashedPassword;
|
||||
description = "Bruno BELANYI";
|
||||
isNormalUser = true;
|
||||
shell = pkgs.zsh;
|
||||
extraGroups = groupsIfExist [
|
||||
"audio" # sound control
|
||||
"media" # access to media files
|
||||
"networkmanager" # wireless configuration
|
||||
"plugdev" # usage of ZSA keyboard tools
|
||||
"video" # screen control
|
||||
"wheel" # `sudo` for the user.
|
||||
];
|
||||
openssh.authorizedKeys.keys = with builtins;
|
||||
let
|
||||
keyDir = ./ssh;
|
||||
contents = readDir keyDir;
|
||||
names = attrNames contents;
|
||||
files = filter (name: contents.${name} == "regular") names;
|
||||
keys = map (basename: readFile (keyDir + "/${basename}")) files;
|
||||
in
|
||||
keys;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue