nix/nixos/users/albert/default.nix
2024-04-29 12:28:40 +09:00

35 lines
1.1 KiB
Nix

{ config, desktop, lib, pkgs, ... }:
let
ifExists = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups;
in {
# Define a user account.
imports = [ ] ++ lib.optional (builtins.isString desktop) ./desktop.nix;
users = {
mutableUsers = false;
users.albert = {
isNormalUser = true;
description = "Albert J. Copeland";
# video is required for the "light" command to work
extraGroups = [ "networkmanager" "wheel" ]
++ ifExists [ "audio" ]
++ ifExists [ "video" ]
++ ifExists [ "docker" ]
++ ifExists [ "podman" ]
++ ifExists [ "syncthing" ];
shell = pkgs.fish;
# mkpasswd -m sha-512
hashedPassword = "$y$j9T$wKLsIWaA4Gf63RvjedwLJ0$EHKL6BBJV0CAxEKcHHjaBqW085KJ/MGvmbyWzmcWOy6";
packages = [ pkgs.home-manager ];
openssh.authorizedKeys.keyFiles = [ ../../../keys/ssh/keys.txt ];
};
groups.albert = {
gid = 1000;
name = "albert";
members = [ "albert" ];
};
};
# Make this user trusted
nix.settings.trusted-users = [ "albert" ];
}