From 7d7cd81fd7cc7e587ff6305dac39d5cfbb81a382 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Tue, 10 Jun 2025 12:52:49 +0200 Subject: [PATCH] nixos/modules/misc/ids: Document more alternatives than DynamicUsers --- nixos/modules/misc/ids.nix | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index 64f0d4247ddc..b50d7c7a50c8 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -6,11 +6,17 @@ # https://github.com/NixOS/rfcs/blob/master/rfcs/0052-dynamic-ids.md # # Use of static ids is deprecated within NixOS. Dynamic allocation is -# required, barring special circumstacnes. Please check if the service +# required, barring special circumstances. Please check if the service # is applicable for systemd's DynamicUser option and does not need a -# uid/gid allocation at all. Systemd can also change ownership of -# service directories using the RuntimeDirectory/StateDirectory -# options. +# uid/gid allocation at all. If DynamicUser is problematic consider +# making a `isSystemUser=true` user with the uid and gid unset and let +# NixOS pick dynamic persistent ids on activation. These IDs are persisted +# locally on the host in the event that the user is removed and added back. +# Systemd will also change ownership of service directories using the +# RuntimeDirectory/StateDirectory options just in case a change happens. +# It's only for special circumstances like for example the ids being hardcoded +# in the application or the ids having to be consistent across multiple hosts +# that configuring static ids in this file makes sense. { lib, ... }: