about summary refs log tree commit diff stats
path: root/modules/by-name/co/constants/module.nix
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-03-29 15:14:51 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-03-29 15:14:51 +0100
commitb67a4c776c08d61f9a1901ee1a2f7af85e46c9e8 (patch)
tree842efe9fd07c87f7f91af7cff604de89af992853 /modules/by-name/co/constants/module.nix
parenthosts/server2: Use the correct path to the DKIM keys (diff)
downloadnixos-server-b67a4c776c08d61f9a1901ee1a2f7af85e46c9e8.zip
modules/constants: Dry gid definitions by inheriting the uids
Diffstat (limited to '')
-rw-r--r--modules/by-name/co/constants/module.nix54
1 files changed, 34 insertions, 20 deletions
diff --git a/modules/by-name/co/constants/module.nix b/modules/by-name/co/constants/module.nix
index fed14d3..9919eb8 100644
--- a/modules/by-name/co/constants/module.nix
+++ b/modules/by-name/co/constants/module.nix
@@ -1,6 +1,10 @@
 # This file is inspired by the `nixos/modules/misc/ids.nix`
 # file in nixpkgs.
-{lib, ...}: {
+{
+  lib,
+  config,
+  ...
+}: {
   options.vhack.constants = {
     ids.uids = lib.mkOption {
       internal = true;
@@ -41,26 +45,36 @@
 
       # As per the NixOS file, the uids should not be greater or equal to 400;
     };
-    ids.gids = {
-      acme = 328;
-      dhcpcd = 329;
-      nscd = 330;
-      sshd = 331;
-      systemd-oom = 332;
-      resolvconf = 333; # This group is not matched to an user?
-      nix-sync = 334;
+    ids.gids = let
+      inherit (config.vhack.constants.ids) uids;
+    in {
+      inherit
+        (uids)
+        acme
+        dhcpcd
+        etebase-server
+        knot-resolver
+        mastodon
+        matrix-synapse
+        mautrix-whatsapp
+        nix-sync
+        nscd
+        opendkim
+        peertube
+        redis-mastodon
+        redis-peertube
+        redis-rspamd
+        redis-stalwart-mail
+        rspamd
+        sshd
+        stalwart-mail
+        systemd-oom
+        virtualMail
+        ;
+
+      # Keep this sorted with `!sort --numeric-sort --key=2 --field-separator="="`
       systemd-coredump = 151; # matches systemd-coredump user
-      redis-peertube = 990;
-      peertube = 992;
-      mastodon = 996;
-      redis-mastodon = 991;
-      matrix-synapse = 224;
-      knot-resolver = 997;
-      redis-rspamd = 989;
-      rspamd = 225;
-      opendkim = 221;
-      virtualMail = 5000;
-      etebase-server = 998;
+      resolvconf = 333; # This group is not matched to an user?
 
       # The gid should match the uid. Thus should not be >= 400;
     };