|
7 | 7 | with lib; let |
8 | 8 | inherit (config) nixflix; |
9 | 9 | inherit (nixflix) globals; |
10 | | - cfg = config.nixflix.${serviceName}; |
| 10 | + cfg = nixflix.${serviceName}; |
11 | 11 | stateDir = "${nixflix.stateDir}/${serviceName}"; |
12 | 12 |
|
13 | 13 | mkWaitForApiScript = import ./mkWaitForApiScript.nix {inherit lib pkgs;}; |
@@ -63,16 +63,16 @@ with lib; let |
63 | 63 | method = "Forms"; |
64 | 64 | }; |
65 | 65 | server = { |
66 | | - inherit (config.nixflix.${serviceName}.config.hostConfig) port urlBase; |
| 66 | + inherit (nixflix.${serviceName}.config.hostConfig) port urlBase; |
67 | 67 | }; |
68 | 68 | } // lib.optionalAttrs config.services.postgresql.enable { |
69 | 69 | log.dbEnabled = true; |
70 | 70 | postgres = { |
71 | | - user = config.nixflix.${serviceName}.user; |
| 71 | + user = nixflix.${serviceName}.user; |
72 | 72 | host = "/run/postgresql"; |
73 | 73 | port = 5432; |
74 | | - mainDb = config.nixflix.${serviceName}.user; |
75 | | - logDb = config.nixflix.${serviceName}.user; |
| 74 | + mainDb = nixflix.${serviceName}.user; |
| 75 | + logDb = nixflix.${serviceName}.user; |
76 | 76 | }; |
77 | 77 | } |
78 | 78 | ''; |
@@ -184,15 +184,15 @@ in { |
184 | 184 | mediaDirs = mkOption { |
185 | 185 | type = types.listOf types.path; |
186 | 186 | default = []; |
187 | | - defaultText = literalExpression ''[config.nixflix.mediaDir + "/<media-type>"]''; |
| 187 | + defaultText = literalExpression ''[nixflix.mediaDir + "/<media-type>"]''; |
188 | 188 | description = "List of media directories to create and manage"; |
189 | 189 | }; |
190 | 190 | }; |
191 | 191 |
|
192 | 192 | config = mkIf (nixflix.enable && cfg.enable) { |
193 | 193 | assertions = [ |
194 | 194 | { |
195 | | - assertion = cfg.vpn.enable -> config.nixflix.mullvad.enable; |
| 195 | + assertion = cfg.vpn.enable -> nixflix.mullvad.enable; |
196 | 196 | message = "Cannot enable VPN routing for ${capitalizedName} (nixflix.${serviceName}.vpn.enable = true) when Mullvad VPN is disabled. Please set nixflix.mullvad.enable = true."; |
197 | 197 | } |
198 | 198 | ]; |
@@ -228,14 +228,14 @@ in { |
228 | 228 | ); |
229 | 229 | }; |
230 | 230 | downloadClients = mkDefault ( |
231 | | - optionals (config.nixflix.sabnzbd.enable or false) [ |
| 231 | + optionals (nixflix.sabnzbd.enable or false) [ |
232 | 232 | { |
233 | 233 | name = "SABnzbd"; |
234 | 234 | implementationName = "SABnzbd"; |
235 | | - inherit (config.nixflix.sabnzbd) apiKeyPath; |
236 | | - inherit (config.nixflix.sabnzbd.settings) host; |
237 | | - inherit (config.nixflix.sabnzbd.settings) port; |
238 | | - urlBase = config.nixflix.sabnzbd.settings.url_base; |
| 235 | + inherit (nixflix.sabnzbd) apiKeyPath; |
| 236 | + inherit (nixflix.sabnzbd.settings) host; |
| 237 | + inherit (nixflix.sabnzbd.settings) port; |
| 238 | + urlBase = nixflix.sabnzbd.settings.url_base; |
239 | 239 | } |
240 | 240 | ] |
241 | 241 | ); |
@@ -337,11 +337,11 @@ in { |
337 | 337 | ["network.target"] |
338 | 338 | ++ (optional (cfg.config.apiKeyPath != null && cfg.config.hostConfig.passwordPath != null) "${serviceName}-env.service") |
339 | 339 | ++ (optional config.services.postgresql.enable "postgresql-ready.target") |
340 | | - ++ (optional config.nixflix.mullvad.enable "mullvad-config.service"); |
| 340 | + ++ (optional nixflix.mullvad.enable "mullvad-config.service"); |
341 | 341 | requires = |
342 | 342 | (optional (cfg.config.apiKeyPath != null && cfg.config.hostConfig.passwordPath != null) "${serviceName}-env.service") |
343 | 343 | ++ (optional config.services.postgresql.enable "postgresql-ready.target"); |
344 | | - wants = optional config.nixflix.mullvad.enable "mullvad-config.service"; |
| 344 | + wants = optional nixflix.mullvad.enable "mullvad-config.service"; |
345 | 345 | wantedBy = ["multi-user.target"]; |
346 | 346 |
|
347 | 347 | serviceConfig = |
|
356 | 356 | // optionalAttrs (cfg.config.apiKeyPath != null && cfg.config.hostConfig.passwordPath != null) { |
357 | 357 | EnvironmentFile = "/run/${serviceName}/env"; |
358 | 358 | } |
359 | | - // optionalAttrs (config.nixflix.mullvad.enable && !cfg.vpn.enable) { |
| 359 | + // optionalAttrs (nixflix.mullvad.enable && !cfg.vpn.enable) { |
360 | 360 | ExecStart = mkForce (pkgs.writeShellScript "${serviceName}-vpn-bypass" '' |
361 | 361 | exec /run/wrappers/bin/mullvad-exclude ${getExe cfg.package} \ |
362 | 362 | -nobrowser -data='${stateDir}' |
|
0 commit comments