# The owner's account (meta.owner, modules/users/faumaray.nix): the only # interactive user. The `docker` and `gamemode` groups are added by the docker # and gaming aspects. { config, ... }: let inherit (config.meta) owner; passwordSecret = "${owner.name}-password"; in { flake.modules.nixos.core = { config, lib, pkgs, ... }: let hasPasswordSecret = config.age.secrets ? ${passwordSecret}; in { users.mutableUsers = true; users.users.${owner.name} = { isNormalUser = true; inherit (owner) uid; description = owner.fullName; extraGroups = [ "wheel" "networkmanager" "video" "audio" "input" "render" "wireshark" ]; shell = pkgs.zsh; openssh.authorizedKeys.keys = owner.sshAuthorizedKeys; # Real password comes from agenix; otherwise a throwaway one so the first # boot can never lock the user out. hashedPasswordFile = lib.mkIf hasPasswordSecret config.age.secrets.${passwordSecret}.path; initialPassword = lib.mkIf (!hasPasswordSecret) "changeme"; }; # Required by `shell = pkgs.zsh` (puts zsh into /etc/shells). programs.zsh.enable = true; security.sudo.wheelNeedsPassword = true; warnings = lib.optional (!hasPasswordSecret) '' User "${owner.name}" has the temporary password "changeme". Run `passwd` after the first login, or add secrets/${passwordSecret}.age (hashed with `mkpasswd -m yescrypt`, encrypted with agenix) and `git add` it. ''; }; }