main
 1{lib, ...}: let
 2  inherit (lib) mkOption types;
 3
 4  sshKeyType = types.submodule {
 5    options = {
 6      tag = mkOption {
 7        type = types.nullOr types.str;
 8        default = null;
 9        description = "Tag to categorize the SSH key (e.g., 'laptop', 'workstation', 'yubikey')";
10      };
11      key = mkOption {
12        type = types.str;
13        description = "SSH public key string";
14      };
15    };
16  };
17in {
18  den.schema.user.imports = [
19    (_: {
20      options = {
21        identity = mkOption {
22          type = types.submodule {
23            options = {
24              displayName = mkOption {
25                type = types.str;
26                default = "";
27                description = "Display name for the user";
28              };
29              email = mkOption {
30                type = types.nullOr types.str;
31                default = null;
32                description = "Email address for the user";
33              };
34              avatar = mkOption {
35                type = types.nullOr types.path;
36                default = null;
37                description = "Avatar for the user";
38              };
39              gpgKey = mkOption {
40                type = types.nullOr (types.either types.path types.str);
41                default = null;
42                description = "GPG key ID for the user";
43              };
44              sshKeys = mkOption {
45                type = types.listOf sshKeyType;
46                default = [];
47                description = "SSH public keys for the user, each with an optional tag";
48              };
49            };
50          };
51          default = {};
52          description = "User identity information";
53        };
54
55        system = mkOption {
56          type = types.submodule {
57            options = {
58              hashedPasswordAged = mkOption {
59                type = types.path;
60                description = "Age encryped hashed password file for user";
61              };
62              settings = mkOption {
63                type = types.attrsOf (types.attrsOf types.anything);
64                default = {};
65                description = "Per-user feature settings (freeform nested namespace)";
66              };
67              themes = mkOption {
68                type = types.attrs;
69                default = {};
70                description = ''
71                  Per-aspect theme selection (tree structure mirroring aspect tree).
72                  Leaf values are theme names (strings). The special key `theme` at the
73                  root sets the global default theme applied to all aspects that do not
74                  have a per-aspect override.
75                '';
76                example = lib.literalExpression ''
77                  {
78                    theme = "catppuccin";
79                    develop.editor.helix = "tokyo-night";
80                  }
81                '';
82              };
83            };
84          };
85          default = {};
86          description = "Unix account defaults and system configuration";
87        };
88      };
89    })
90  ];
91}