summary refs log tree commit diff stats
path: root/modules/by-name/co/constants
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-12-25 18:23:05 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-12-25 18:23:05 +0100
commit35071eeb107c982925fda3fcef6bbd44940cbb21 (patch)
tree6aee2a170ff0ffb24b4cad9c3f03f3064bb7d925 /modules/by-name/co/constants
parentdocs(CONTRIBUTING.md): Remove (diff)
downloadnixos-server-35071eeb107c982925fda3fcef6bbd44940cbb21.tar.gz
nixos-server-35071eeb107c982925fda3fcef6bbd44940cbb21.zip
fix(treewide): Add constant uids and gids to each user and group
This allows us to avoid persisting `/var/lib/nixos`.
Diffstat (limited to 'modules/by-name/co/constants')
-rw-r--r--modules/by-name/co/constants/module.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/modules/by-name/co/constants/module.nix b/modules/by-name/co/constants/module.nix
new file mode 100644
index 0000000..a28ea0c
--- /dev/null
+++ b/modules/by-name/co/constants/module.nix
@@ -0,0 +1,43 @@
+# This file is inspired by the `nixos/modules/misc/ids.nix`
+# file in nixpkgs.
+{lib, ...}: {
+  options.vhack.constants = {
+    ids.uids = lib.mkOption {
+      internal = true;
+      description = ''
+        The user IDs used in the vhack.eu nixos config.
+      '';
+      type = lib.types.attrsOf lib.types.int;
+    };
+    ids.gids = lib.mkOption {
+      internal = true;
+      description = ''
+        The group IDs used in the vhack.eu nixos config.
+      '';
+      type = lib.types.attrsOf lib.types.int;
+    };
+  };
+
+  config.vhack.constants = {
+    ids.uids = {
+      acme = 328;
+      dhcpcd = 329;
+      nscd = 330;
+      sshd = 331;
+      systemd-oom = 332;
+
+      # 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?
+      systemd-coredump = 151; # matches systemd-coredump user
+
+      # The gid should match the uid. Thus should not be >= 400;
+    };
+  };
+}