aboutsummaryrefslogtreecommitdiffstats
path: root/modules/vhack/co
diff options
context:
space:
mode:
Diffstat (limited to 'modules/vhack/co')
-rw-r--r--modules/vhack/co/constants/module.nix114
-rw-r--r--modules/vhack/co/coredump/module.nix18
2 files changed, 132 insertions, 0 deletions
diff --git a/modules/vhack/co/constants/module.nix b/modules/vhack/co/constants/module.nix
new file mode 100644
index 0000000..9127488
--- /dev/null
+++ b/modules/vhack/co/constants/module.nix
@@ -0,0 +1,114 @@
+# This file is inspired by the `nixos/modules/misc/ids.nix`
+# file in nixpkgs.
+{
+ lib,
+ config,
+ ...
+}: {
+ 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.ints.between 0 400);
+ };
+ ids.gids = lib.mkOption {
+ internal = true;
+ description = ''
+ The group IDs used in the vhack.eu nixos config.
+ '';
+ type = lib.types.attrsOf (lib.types.ints.between 0 400);
+ };
+ };
+
+ config.vhack.constants = {
+ ids.uids = {
+ # Keep this sorted with `!sort --numeric-sort --key=2 --field-separator="="`
+ systemd-coredump = 151; # GROUP
+ opendkim = 221;
+ mautrix-whatsapp = 222;
+ etebase-server = 223;
+ matrix-synapse = 224;
+ rspamd = 225;
+ knot-resolver = 226;
+ peertube = 231;
+ redis-mastodon = 232;
+ redis-peertube = 233;
+ redis-rspamd = 234;
+ redis-stalwart-mail = 235;
+ mastodon = 236;
+ stalwart-mail = 238;
+ acme = 328;
+ dhcpcd = 329;
+ nscd = 330;
+ sshd = 331;
+ systemd-oom = 332;
+ resolvconf = 333; # GROUP
+ nix-sync = 334;
+ nextcloud = 335;
+ redis-nextcloud = 336;
+ taskchampion = 337;
+ stalwart-mail-certificates = 338; # GROUP
+ sharkey = 339;
+ redis-sharkey = 340;
+ grocy = 341;
+ anubis = 342;
+ postfix-tlspol = 343;
+ rocie = 344;
+ fluent-bit = 345;
+ loki = 346;
+ grafana = 347;
+ node-exporter = 348;
+ smartctl-exporter-access = 349;
+
+ # As per the NixOS file, the uids should not be greater or equal to 400;
+ };
+ ids.gids = let
+ inherit (config.vhack.constants.ids) uids;
+ in {
+ # Please add your groups to the users and inherit them here.
+ # This avoids having an user/group id mismatch.
+ inherit
+ (uids)
+ acme
+ anubis
+ dhcpcd
+ etebase-server
+ knot-resolver
+ mastodon
+ matrix-synapse
+ mautrix-whatsapp
+ nextcloud
+ nix-sync
+ nscd
+ opendkim
+ peertube
+ postfix-tlspol
+ redis-mastodon
+ redis-nextcloud
+ redis-peertube
+ redis-rspamd
+ redis-stalwart-mail
+ rspamd
+ sshd
+ stalwart-mail
+ systemd-oom
+ sharkey
+ redis-sharkey
+ grocy
+ systemd-coredump # matches systemd-coredump user
+ resolvconf # This group is not matched to an user?
+ stalwart-mail-certificates # This group is used to connect nginx and stalwart-mail
+ rocie
+ fluent-bit
+ loki
+ grafana
+ node-exporter
+ smartctl-exporter-access
+ ;
+
+ # The gid should match the uid. Thus should not be >= 400;
+ };
+ };
+}
diff --git a/modules/vhack/co/coredump/module.nix b/modules/vhack/co/coredump/module.nix
new file mode 100644
index 0000000..ce28ed9
--- /dev/null
+++ b/modules/vhack/co/coredump/module.nix
@@ -0,0 +1,18 @@
+{
+ config,
+ lib,
+ ...
+}: let
+ cfg = config.vhack.systemd.coredump;
+in {
+ options.vhack.systemd.coredump = {
+ # NOTE(@bpeetz): Enabled by default, because that is what NixOS also does. <2024-12-25>
+ enable = (lib.mkEnableOption "oomd") // {default = true;};
+ };
+
+ config = lib.mkIf cfg.enable {
+ users = {
+ groups.systemd-coredump.gid = config.vhack.constants.ids.gids.systemd-coredump;
+ };
+ };
+}