Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Some Static IDs #367563

Merged
merged 3 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ nixos/modules/installer/tools/nix-fallback-paths.nix @NixOS/nix-team @raitobeza
/nixos/default.nix @infinisil
/nixos/lib/from-env.nix @infinisil
/nixos/lib/eval-config.nix @infinisil
/nixos/modules/misc/ids.nix @R-VdP
/nixos/modules/system/activation/bootspec.nix @grahamc @cole-h @raitobezarius
/nixos/modules/system/activation/bootspec.cue @grahamc @cole-h @raitobezarius

Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/hardware/uinput.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ in
config = lib.mkIf cfg.enable {
boot.kernelModules = [ "uinput" ];

users.groups.uinput.gid = config.ids.gids.uinput;
users.groups.uinput = { };

services.udev.extraRules = ''
SUBSYSTEM=="misc", KERNEL=="uinput", MODE="0660", GROUP="uinput", OPTIONS+="static_node=uinput"
Expand Down
18 changes: 9 additions & 9 deletions nixos/modules/misc/ids.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
# central list to prevent id collisions.

# IMPORTANT!
# We only add static uids and gids for services where it is not feasible
# to change uids/gids on service start, for example a service with a lot of
# files. Please also 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.
#
# 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
# 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.

{ lib, ... }:

Expand Down Expand Up @@ -355,7 +358,6 @@ in
rstudio-server = 324;
localtimed = 325;
automatic-timezoned = 326;
whisparr = 328;

# When adding a uid, make sure it doesn't match an existing gid.
#
Expand Down Expand Up @@ -683,8 +685,6 @@ in
rstudio-server = 324;
localtimed = 325;
automatic-timezoned = 326;
uinput = 327;
whisparr = 328;

# When adding a gid, make sure it doesn't match an existing
# uid. Users and groups with the same name should have equal
Expand Down
4 changes: 2 additions & 2 deletions nixos/modules/services/misc/whisparr.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ in
whisparr = {
group = cfg.group;
home = cfg.dataDir;
uid = config.ids.uids.whisparr;
isSystemUser = true;
};
};

users.groups = lib.mkIf (cfg.group == "whisparr") { whisparr.gid = config.ids.gids.whisparr; };
users.groups.whisparr = lib.mkIf (cfg.group == "whisparr") { };
};
}
Loading