nix-config/modules/users.nix
Bruno BELANYI 3b148ad684 porthos: split into modules
I have separated the modules into host-specific settings, and generic
settings that ought to be shared by every host.

I only have the 'porthos' host for now, but intend to also add my laptop
'aramis' at some point to this repository.
2021-02-08 10:49:59 +00:00

26 lines
754 B
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# User setup
{ config, ... }:
let
my = config.my;
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;
extraGroups = [ "wheel" ]; # Enable 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;
};
}