245245
246246 systemd . services =
247247 {
248- # Service that waits for PostgreSQL database role to be ready
249248 "${ serviceName } -wait-for-db" = mkIf config . services . postgresql . enable {
250249 description = "Wait for ${ capitalizedName } PostgreSQL database role to be ready" ;
251250 after = [ "postgresql.service" "postgresql-setup.service" ] ;
272271 '' ;
273272 } ;
274273
275- # Ensure main service (radarr.service, etc.) starts after
276- # directories are created and configured dependencies
277274 ${ serviceName } = {
278275 after =
279276 [ "nixflix-setup-dirs.service" ]
@@ -286,10 +283,8 @@ in {
286283 ++ ( optional config . services . postgresql . enable "postgresql-ready.target" ) ;
287284 wants = optional config . nixflix . mullvad . enable "mullvad-config.service" ;
288285
289- # Always use static users and configure VPN bypass
290286 serviceConfig =
291287 {
292- # DynamicUser causes issues with VPN bypass and permissions
293288 DynamicUser = mkForce false ;
294289 User = cfg . user ;
295290 Group = cfg . group ;
@@ -298,21 +293,16 @@ in {
298293 EnvironmentFile = "/run/${ serviceName } /env" ;
299294 }
300295 // optionalAttrs ( config . nixflix . mullvad . enable && ! cfg . vpn . enable ) {
301- # Bypass VPN by wrapping with mullvad-exclude
302296 ExecStart = mkForce ( pkgs . writeShellScript "${ serviceName } -vpn-bypass" ''
303297 exec /run/wrappers/bin/mullvad-exclude ${ getExe config . services . ${ serviceName } . package } \
304298 -nobrowser -data='${ stateDir } '
305299 '' ) ;
306- # mullvad-exclude needs CAP_SYS_ADMIN to manipulate cgroups
307300 AmbientCapabilities = "CAP_SYS_ADMIN" ;
308- # Delegate allows the service to manage its cgroup subtree
309301 Delegate = mkForce true ;
310302 } ;
311303 } ;
312304 }
313- # Only create config and rootfolders services if apiKeyPath is configured
314305 // optionalAttrs ( cfg . config . apiKeyPath != null && cfg . config . hostConfig . passwordPath != null ) {
315- # Create environment file setup service
316306 "${ serviceName } -env" = {
317307 description = "Setup ${ capitalizedName } environment file" ;
318308 wantedBy = [ "${ serviceName } .service" ] ;
@@ -333,14 +323,11 @@ in {
333323 '' ;
334324 } ;
335325
336- # Configure service via API
337326 "${ serviceName } -config" = mkArrHostConfigService serviceName cfg . config ;
338327 }
339- # Only create root folders service if rootFolders is not empty
340328 // optionalAttrs ( usesMediaDirs && cfg . config . apiKeyPath != null && cfg . config . rootFolders != [ ] ) {
341329 "${ serviceName } -rootfolders" = mkArrRootFoldersService serviceName cfg . config ;
342330 }
343- # Only create download clients service if downloadClients is not empty
344331 // optionalAttrs ( cfg . config . apiKeyPath != null ) {
345332 "${ serviceName } -downloadclients" = mkArrDownloadClientsService serviceName cfg . config ;
346333 } ;
0 commit comments