nixos: create 'modules/nixos' folder
Let's consolidate all modules under one path, so that NixOS, home-manager, and nix-darwin (if I ever end up using it down the line) would go under the same folder.
This commit is contained in:
parent
b52e56ed08
commit
c856933803
74 changed files with 1 additions and 1 deletions
51
modules/nixos/system/users/default.nix
Normal file
51
modules/nixos/system/users/default.nix
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
# User setup
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
secrets = config.age.secrets;
|
||||
cfg = config.my.system.users;
|
||||
groupExists = grp: builtins.hasAttr grp config.users.groups;
|
||||
groupsIfExist = builtins.filter groupExists;
|
||||
in
|
||||
{
|
||||
options.my.system.users = with lib; {
|
||||
enable = my.mkDisableOption "user configuration";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
users = {
|
||||
mutableUsers = false; # I want it to be declarative.
|
||||
|
||||
users = {
|
||||
root = {
|
||||
hashedPasswordFile = secrets."users/root/hashed-password".path;
|
||||
};
|
||||
|
||||
${config.my.user.name} = {
|
||||
hashedPasswordFile = secrets."users/ambroisie/hashed-password".path;
|
||||
description = "Bruno BELANYI";
|
||||
isNormalUser = true;
|
||||
shell = pkgs.zsh;
|
||||
extraGroups = groupsIfExist [
|
||||
"audio" # sound control
|
||||
"docker" # usage of `docker` socket
|
||||
"media" # access to media files
|
||||
"networkmanager" # wireless configuration
|
||||
"plugdev" # usage of ZSA keyboard tools
|
||||
"podman" # usage of `podman` socket
|
||||
"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