summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-12-25 18:45:14 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-12-25 18:45:14 +0100
commitc01b4e2dbeb7adf710296849dff3006d39696742 (patch)
tree1477a0889fcdb6bd1b192ba2658fb1dd3375c86e
parentbuild(flake.nix): Re-add `ragenix` to the devShell (diff)
downloadnixos-server-c01b4e2dbeb7adf710296849dff3006d39696742.tar.gz
nixos-server-c01b4e2dbeb7adf710296849dff3006d39696742.zip
fix(modules/dhcpcd): Also set uid/gid for the `dhcpcd` user
Otherwise, this user's/group's owned files/directories could change when
a new user is added or removed, as we do not persist `/var/lib/nixos`.
-rw-r--r--modules/by-name/dh/dhcpcd/module.nix18
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/by-name/dh/dhcpcd/module.nix b/modules/by-name/dh/dhcpcd/module.nix
new file mode 100644
index 0000000..0e35af3
--- /dev/null
+++ b/modules/by-name/dh/dhcpcd/module.nix
@@ -0,0 +1,18 @@
+{
+  config,
+  lib,
+  ...
+}: let
+  cfg = config.vhack.dhcpcd;
+in {
+  options.vhack.dhcpcd = {
+    enable = (lib.mkEnableOption "dhcpcd") // {default = config.networking.dhcpcd.enable;};
+  };
+
+  config = lib.mkIf cfg.enable {
+    users = {
+      users.dhcpcd.uid = config.vhack.constants.ids.uids.dhcpcd;
+      groups.dhcpcd.gid = config.vhack.constants.ids.gids.dhcpcd;
+    };
+  };
+}