nixos/netbox: add services to redis group conditionally

This only makes sense when there is a local redis group, and then we
can scope the group membership to the service instead of the whole user.
This commit is contained in:
Martin Weinelt
2026-07-07 17:43:39 +02:00
parent f0cd25ba33
commit 7f7d069ad7
+4 -1
View File
@@ -81,6 +81,7 @@ let
lib.cli.toCommandLineShellGNU { } {
preserve-environment = true;
user = "netbox";
supp-group = if cfg.redis.createLocally then config.services.redis.servers.netbox.group else null;
}
} -- ${finalPackage}/bin/netbox "$@";;
"netbox")
@@ -608,6 +609,9 @@ in
RestartSec = 30;
Slice = "system-netbox.slice";
EnvironmentFile = cfg.environmentFiles;
SupplementaryGroups = lib.optionals cfg.redis.createLocally [
config.services.redis.servers.netbox.group
];
AmbientCapabilities = [ "" ];
CapabilityBoundingSet = [ "" ];
@@ -775,7 +779,6 @@ in
group = "netbox";
};
users.groups.netbox = { };
users.groups."${config.services.redis.servers.netbox.user}".members = [ "netbox" ];
}
(lib.mkIf cfg.nginx.enable {