aboutsummaryrefslogtreecommitdiffstats
path: root/modules/by-name/co
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-08-24 15:10:22 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-08-24 15:10:22 +0200
commit0c38364b28e3443ac45b56c08787bb70a2b30b28 (patch)
tree38140123e5283896dea43779ee37e9f3e509a25c /modules/by-name/co
parentmodules/hledger: Remove `hledger-edit` (diff)
downloadnixos-config-0c38364b28e3443ac45b56c08787bb70a2b30b28.zip
modules/: Hard-code user and group ids
This avoids relying on the state in /var/lib/nixos
Diffstat (limited to 'modules/by-name/co')
-rw-r--r--modules/by-name/co/constants/module.nix57
-rw-r--r--modules/by-name/co/coredump/module.nix17
2 files changed, 74 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 00000000..5711e9cf
--- /dev/null
+++ b/modules/by-name/co/constants/module.nix
@@ -0,0 +1,57 @@
+# This file is inspired by the `nixos/modules/misc/ids.nix`
+# file in nixpkgs.
+{lib, ...}: {
+ options.soispha.constants = {
+ ids.uids = lib.mkOption {
+ internal = true;
+ description = ''
+ The user IDs used in this nixos config.
+ '';
+ type = lib.types.attrsOf (lib.types.ints.between 0 1000);
+ };
+ ids.gids = lib.mkOption {
+ internal = true;
+ description = ''
+ The group IDs used in this nixos config.
+ '';
+ type = lib.types.attrsOf (lib.types.ints.between 0 1000);
+ };
+ };
+
+ config.soispha.constants = {
+ ids.uids = {
+ # Keep this sorted with `!sort --numeric-sort --key=2 --field-separator="="`
+
+ dhcpcd = 992;
+ systemd-oom = 993;
+ sshd = 994;
+ rtkit = 995;
+ nscd = 996;
+ nm-iodine = 997;
+ fwupd-refresh = 998;
+ avahi = 999;
+
+ # As per the NixOS file, the uids should not be greater or equal to 400;
+ };
+ ids.gids = {
+ # Please add your groups to the users and inherit them here.
+ # This avoids having an user/group id mismatch.
+
+ dhcpcd = 987;
+ lpadmin = 988;
+ resolvconf = 989;
+ systemd-oom = 990;
+ systemd-coredump = 991;
+ sshd = 992;
+ rtkit = 993;
+ polkituser = 994;
+ nscd = 995;
+ msr = 996;
+ fwupd-refresh = 997;
+ avahi = 998;
+ adbusers = 999;
+
+ # The gid should match the uid. Thus should not be >= 400;
+ };
+ };
+}
diff --git a/modules/by-name/co/coredump/module.nix b/modules/by-name/co/coredump/module.nix
new file mode 100644
index 00000000..79e764eb
--- /dev/null
+++ b/modules/by-name/co/coredump/module.nix
@@ -0,0 +1,17 @@
+{
+ config,
+ lib,
+ ...
+}: let
+ cfg = config.soispha.systemd.coredump;
+in {
+ options.soispha.systemd.coredump = {
+ enable = (lib.mkEnableOption "oomd") // {default = config.systemd.coredump.enable;};
+ };
+
+ config = lib.mkIf cfg.enable {
+ users = {
+ groups.systemd-coredump.gid = config.soispha.constants.ids.gids.systemd-coredump;
+ };
+ };
+}