aboutsummaryrefslogtreecommitdiff
path: root/flakes/myuids/flake.nix
blob: ff33651081fe44ee011316d279120887b444dfd6 (plain) (blame)
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
{
  description = "Immae Specific uids";

  outputs = { self }: {
    lib = {
      # Check that there is no clash with nixos/modules/misc/ids.nix
      uids = {
        cryptpad = 386;
        openldap = 99; # commented in the ids file
        postfixscripts = 387;
        acme = 388;
        backup = 389;
        vhost = 390;
        openarc = 391;
        opendmarc = 392;
        peertube = 394;
        redis = 395;
        nullmailer = 396;
        mediagoblin = 397;
        diaspora = 398;
        mastodon = 399;
      };
      gids = {
        nagios = 11; # commented in the ids file
        openldap = 99; # commented in the ids file
        cryptpad = 386;
        acme = 388;
        backup = 389;
        vhost = 390;
        openarc = 391;
        opendmarc = 392;
        peertube = 394;
        redis = 395;
        nullmailer = 396;
        mediagoblin = 397;
        diaspora = 398;
        mastodon = 399;
      };
    };
    nixosModule = { config, lib, ... }: {
      config = {
        ids.uids = self.lib.uids;
        ids.gids = self.lib.gids;
        assertions = [
          {
            assertion = builtins.length (builtins.attrValues config.ids.gids) == builtins.length (lib.unique (builtins.attrValues config.ids.gids));
            message = "Non-unique list of gids";
          }
          {
            assertion = builtins.length (builtins.attrValues config.ids.uids) == builtins.length (lib.unique (builtins.attrValues config.ids.uids));
            message = "Non-unique list of uids";
          }
        ];
      };
    };
  };
}