summaryrefslogtreecommitdiff
path: root/modules/users/user.nix
blob: 60592fc4dbf3c4b60527ae2378d84a4b6a37a98f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
{ name, lib, ... }:

with lib;

{
  options = {
    name = mkOption {
      type = types.str;
      description = lib.mdDoc ''
        The name of the user account. If undefined, the name of the
        attribute set will be used.
      '';
    };

    description = mkOption {
      type = types.str;
      default = "";
      example = "Alice Q. User";
      description = lib.mdDoc ''
        A short description of the user account, typically the
        user's full name.
      '';
    };

    uid = mkOption {
      type = types.int;
      description = lib.mdDoc "The user's UID.";
    };

    gid = mkOption {
      type = types.int;
      default = 20;
      description = lib.mdDoc "The user's primary group.";
    };

    isHidden = mkOption {
      type = types.bool;
      default = true;
      description = lib.mdDoc "Whether to make the user account hidden.";
    };

    # extraGroups = mkOption {
    #   type = types.listOf types.str;
    #   default = [];
    #   description = "The user's auxiliary groups.";
    # };

    home = mkOption {
      type = types.path;
      default = "/var/empty";
      description = lib.mdDoc "The user's home directory.";
    };

    createHome = mkOption {
      type = types.bool;
      default = false;
      description = lib.mdDoc "Create the home directory when creating the user.";
    };

    shell = mkOption {
      type = types.either types.shellPackage types.path;
      default = "/sbin/nologin";
      example = literalExpression "pkgs.bashInteractive";
      description = lib.mdDoc "The user's shell.";
    };

    packages = mkOption {
      type = types.listOf types.package;
      default = [];
      example = literalExpression "[ pkgs.firefox pkgs.thunderbird ]";
      description = lib.mdDoc ''
        The set of packages that should be made availabe to the user.
        This is in contrast to {option}`environment.systemPackages`,
        which adds packages to all users.
      '';
    };
  };

  config = {

    name = mkDefault name;

  };
}