{ lib, config, pkgs, ... }: let inherit (lib) types mkIf mkDefault; inherit (lib.metacfg) mkOpt; cfg = config.metacfg.user; is-linux = pkgs.stdenv.isLinux; is-darwin = pkgs.stdenv.isDarwin; in { options.metacfg.user = { name = mkOpt types.str "harald" "The user account."; fullName = mkOpt types.str "Harald Hoyer" "The full name of the user."; email = mkOpt types.str "harald@hoyer.xyz" "The email of the user."; uid = mkOpt (types.nullOr types.int) 501 "The uid for the user account."; sshKeys = mkOpt (types.listOf types.str) [ "sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIDsb/Tr69YN5MQLweWPuJaRGm+h2kOyxfD6sqKEDTIwoAAAABHNzaDo= harald@fedora.fritz.box" "sk-ecdsa-sha2-nistp256@openssh.com AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBACLgT81iB1iWWVuXq6PdQ5GAAGhaZhSKnveQCvcNnAOZ5WKH80bZShKHyAYzrzbp8IGwLWJcZQ7TqRK+qZdfagAAAAEc3NoOg== harald@hoyer.xyz" "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBAYbUTKpy4QR3s944/hjJ1UK05asFEs/SmWeUbtS0cdA660sT4xHnRfals73FicOoz+uIucJCwn/SCM804j+wtM=" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMNsmP15vH8BVKo7bdvIiiEjiQboPGcRPqJK0+bH4jKD harald@lenovo.fritz.box" ] "ssh keys"; }; config = { users.users.${cfg.name} = { # NOTE: Setting the uid here is required for another # module to evaluate successfully since it reads # `users.users.${metacfg.user.name}.uid`. uid = mkIf (cfg.uid != null) cfg.uid; openssh.authorizedKeys.keys = cfg.sshKeys; }; snowfallorg.users.${config.metacfg.user.name}.home.config = { home = { file = { ".profile".text = '' # The default file limit is far too low and throws an error when rebuilding the system. # See the original with: ulimit -Sa ulimit -n 4096 ''; }; }; }; }; }