2023-05-28 02:00:10 +02:00
|
|
|
{ pkgs, outputs, config, lib, ... }:
|
2023-01-10 20:39:33 +01:00
|
|
|
let
|
|
|
|
# Record containing all the hosts
|
|
|
|
hosts = outputs.nixosConfigurations;
|
|
|
|
|
|
|
|
# Function from hostname to relative path to public ssh key
|
|
|
|
idKey = host: ../../${host}/id_ed25519.pub;
|
|
|
|
in
|
2023-01-10 02:38:06 +01:00
|
|
|
{
|
|
|
|
# Password file stored through agenix
|
2023-01-10 16:05:48 +01:00
|
|
|
age.secrets.adrielusPassword.file = ./adrielus_password.age;
|
2023-01-10 02:38:06 +01:00
|
|
|
|
|
|
|
users = {
|
|
|
|
# Configure users through nix only
|
|
|
|
mutableUsers = false;
|
|
|
|
|
|
|
|
# Create an user named adrielus
|
|
|
|
users.adrielus = {
|
2023-05-28 02:00:10 +02:00
|
|
|
# Adds me to some default groups, and creates the home dir
|
|
|
|
isNormalUser = true;
|
2023-01-12 20:49:08 +01:00
|
|
|
|
2023-01-10 02:38:06 +01:00
|
|
|
# File containing my password, managed by agenix
|
|
|
|
passwordFile = config.age.secrets.adrielusPassword.path;
|
|
|
|
|
2023-05-28 02:00:10 +02:00
|
|
|
# Set default shell
|
|
|
|
shell = pkgs.fish;
|
|
|
|
|
2023-01-10 02:38:06 +01:00
|
|
|
# Add user to the following groups
|
|
|
|
extraGroups = [
|
2023-05-28 02:00:10 +02:00
|
|
|
"wheel" # Access to sudo
|
|
|
|
"lp" # Printers
|
|
|
|
"audio" # Audio devices
|
|
|
|
"video" # Webcam and the like
|
|
|
|
"network" # for wireless stuff (???)
|
2023-01-10 02:38:06 +01:00
|
|
|
];
|
|
|
|
|
2023-01-12 20:49:08 +01:00
|
|
|
openssh.authorizedKeys.keyFiles =
|
2023-05-28 02:00:10 +02:00
|
|
|
lib.pipe hosts [
|
|
|
|
# attrsetof host -> attrsetof path
|
|
|
|
(builtins.mapAttrs
|
|
|
|
(name: _: idKey name)) # string -> host -> path
|
|
|
|
|
|
|
|
# attrsetof path -> path[]
|
|
|
|
builtins.attrValues
|
|
|
|
|
|
|
|
# path[] -> path[]
|
|
|
|
(builtins.filter builtins.pathExists)
|
|
|
|
];
|
2023-01-12 20:49:08 +01:00
|
|
|
};
|
2023-01-10 02:38:06 +01:00
|
|
|
};
|
|
|
|
}
|