Skip to content

Commit ed03aa6

Browse files
committed
Merge branch 'main' into jellyfin
2 parents 3e21a99 + d2523f6 commit ed03aa6

17 files changed

Lines changed: 113 additions & 84 deletions

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ Add nixflix to your flake inputs:
6565
# Add service dependencies (e.g., wait for encrypted drive to mount)
6666
serviceDependencies = ["unlock-raid.service"];
6767
68-
# Configure URL base for all services (affects service internal config)
69-
serviceNameIsUrlBase = true; # Services use /sonarr, /radarr, etc. as urlBase
70-
7168
# Enable nginx reverse proxy
7269
nginx.enable = true;
7370

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/arr-common/downloadClients.nix

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ in {
3232
});
3333
default = [];
3434
defaultText = literalExpression ''
35-
lib.optionals (config.nixflix.sabnzbd.enable or false) [
35+
lib.optionals (nixflix.sabnzbd.enable or false) [
3636
{
3737
name = "SABnzbd";
3838
implementationName = "SABnzbd";
39-
apiKeyPath = config.nixflix.sabnzbd.apiKeyPath;
40-
host = config.nixflix.sabnzbd.settings.host;
41-
port = config.nixflix.sabnzbd.settings.port;
42-
urlBase = config.nixflix.sabnzbd.settings.url_base;
39+
apiKeyPath = nixflix.sabnzbd.apiKeyPath;
40+
host = nixflix.sabnzbd.settings.host;
41+
port = nixflix.sabnzbd.settings.port;
42+
urlBase = nixflix.sabnzbd.settings.url_base;
4343
}
4444
]
4545
'';

modules/arr-common/hostConfigType.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ with lib;
5252
urlBase = mkOption {
5353
type = types.str;
5454
default = "";
55-
defaultText = literalExpression ''if config.nixflix.serviceNameIsUrlBase then "/<serviceName>" else ""'';
55+
defaultText = literalExpression ''if nixflix.nginx.enable then "/<serviceName>" else ""'';
5656
description = "URL base path";
5757
};
5858

modules/arr-common/mkArrServiceModule.nix

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ in {
222222
passwordPath = mkDefault null;
223223
instanceName = mkDefault capitalizedName;
224224
urlBase = mkDefault (
225-
if nixflix.serviceNameIsUrlBase
225+
if nixflix.nginx.enable
226226
then "/${serviceName}"
227227
else ""
228228
);
@@ -258,14 +258,23 @@ in {
258258
if cfg.config.hostConfig.urlBase == ""
259259
then "/"
260260
else cfg.config.hostConfig.urlBase
261-
}" = {
261+
}" = let
262+
themeParkUrl = "https://theme-park.dev/css/base/${serviceName}/${nixflix.theme.name}.css";
263+
in {
262264
proxyPass = "http://127.0.0.1:${builtins.toString cfg.config.hostConfig.port}";
263265
recommendedProxySettings = true;
264266
extraConfig = ''
265-
proxy_set_header X-Forwarded-Host $host;
266-
proxy_set_header X-Forwarded-Server $host;
267-
proxy_set_header X-Forwarded-Proto $scheme;
268267
proxy_redirect off;
268+
269+
${
270+
if nixflix.theme.enable
271+
then ''
272+
proxy_set_header Accept-Encoding "";
273+
sub_filter '</body>' '<link rel="stylesheet" type="text/css" href="${themeParkUrl}"></body>';
274+
sub_filter_once on;
275+
''
276+
else ""
277+
}
269278
'';
270279
};
271280
};

modules/arr-common/rootFolders.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ in {
99
options = mkOption {
1010
type = types.listOf types.attrs;
1111
default = [];
12-
defaultText = literalExpression ''map (mediaDir: {path = mediaDir;}) config.nixflix.<serviceName>.mediaDirs'';
12+
defaultText = literalExpression ''map (mediaDir: {path = mediaDir;}) nixflix.<serviceName>.mediaDirs'';
1313
description = ''
1414
List of root folders to create via the API /rootfolder endpoint.
1515
Each folder is an attribute set that will be converted to JSON and sent to the API.

modules/default.nix

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,7 @@ in {
2121
];
2222

2323
options.nixflix = {
24-
enable = mkOption {
25-
type = types.bool;
26-
default = false;
27-
example = true;
28-
description = "Whether or not to enable the nixflix module for Jellyfin media server stack";
29-
};
24+
enable = mkEnableOption "Nixflix";
3025

3126
serviceDependencies = mkOption {
3227
type = with types; listOf str;
@@ -38,6 +33,22 @@ in {
3833
'';
3934
};
4035

36+
theme = {
37+
enable = mkEnableOption "Theme";
38+
name = mkOption {
39+
type = types.str;
40+
default = "plex";
41+
description = ''
42+
This is powered theme.park
43+
https://docs.theme-park.dev/
44+
45+
The name of any official theme or community theme supported by theme.park.
46+
https://docs.theme-park.dev/theme-options/
47+
https://docs.theme-park.dev/community-themes/
48+
'';
49+
};
50+
};
51+
4152
nginx = {
4253
enable = mkOption {
4354
type = types.bool;
@@ -46,16 +57,6 @@ in {
4657
};
4758
};
4859

49-
serviceNameIsUrlBase = mkOption {
50-
type = types.bool;
51-
default = false;
52-
description = ''
53-
Whether to use the service name as the URL base (e.g., /sonarr, /radarr).
54-
When false, services will use "/" as the default URL base.
55-
When true, services will use "/{serviceName}" as the default URL base.
56-
'';
57-
};
58-
5960
mediaUsers = mkOption {
6061
type = with types; listOf str;
6162
default = [];

modules/postgres/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
}:
77
with lib; let
88
inherit (config) nixflix;
9-
cfg = config.nixflix.postgres;
9+
cfg = nixflix.postgres;
1010
stateDir = "${nixflix.stateDir}/postgres";
1111
in {
1212
options.nixflix.postgres = {

modules/prowlarr/default.nix

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
...
66
}:
77
with lib; let
8+
inherit (config) nixflix;
89
indexers = import ./indexers.nix {
910
inherit lib pkgs;
1011
serviceName = "prowlarr";
@@ -17,19 +18,19 @@ with lib; let
1718
arrServices = ["lidarr" "radarr" "sonarr"];
1819

1920
mkDefaultApplication = serviceName: let
20-
serviceConfig = config.nixflix.${serviceName}.config;
21+
serviceConfig = nixflix.${serviceName}.config;
2122
capitalizedName = lib.toUpper (builtins.substring 0 1 serviceName) + builtins.substring 1 (-1) serviceName;
22-
useNginx = config.nixflix.nginx.enable or false;
23+
useNginx = nixflix.nginx.enable or false;
2324
baseUrl =
2425
if useNginx
2526
then "http://127.0.0.1${serviceConfig.hostConfig.urlBase}"
2627
else "http://127.0.0.1:${toString serviceConfig.hostConfig.port}${serviceConfig.hostConfig.urlBase}";
2728
prowlarrUrl =
2829
if useNginx
29-
then "http://127.0.0.1${config.nixflix.prowlarr.config.hostConfig.urlBase}"
30-
else "http://127.0.0.1:${toString config.nixflix.prowlarr.config.hostConfig.port}${config.nixflix.prowlarr.config.hostConfig.urlBase}";
30+
then "http://127.0.0.1${nixflix.prowlarr.config.hostConfig.urlBase}"
31+
else "http://127.0.0.1:${toString nixflix.prowlarr.config.hostConfig.port}${nixflix.prowlarr.config.hostConfig.urlBase}";
3132
in
32-
mkIf (config.nixflix.${serviceName}.enable or false) {
33+
mkIf (nixflix.${serviceName}.enable or false) {
3334
name = capitalizedName;
3435
implementationName = capitalizedName;
3536
apiKeyPath = mkDefault serviceConfig.apiKeyPath;
@@ -59,12 +60,12 @@ in {
5960
};
6061
};
6162

62-
systemd.services."prowlarr-indexers" = mkIf (config.nixflix.enable && config.nixflix.prowlarr.enable && config.nixflix.prowlarr.config.apiKeyPath != null) (
63-
indexers.mkService config.nixflix.prowlarr.config
63+
systemd.services."prowlarr-indexers" = mkIf (nixflix.enable && nixflix.prowlarr.enable && nixflix.prowlarr.config.apiKeyPath != null) (
64+
indexers.mkService nixflix.prowlarr.config
6465
);
6566

66-
systemd.services."prowlarr-applications" = mkIf (config.nixflix.enable && config.nixflix.prowlarr.enable && config.nixflix.prowlarr.config.apiKeyPath != null) (
67-
applications.mkService config.nixflix.prowlarr.config
67+
systemd.services."prowlarr-applications" = mkIf (nixflix.enable && nixflix.prowlarr.enable && nixflix.prowlarr.config.apiKeyPath != null) (
68+
applications.mkService nixflix.prowlarr.config
6869
);
6970
};
7071
}

modules/recyclarr/cleanup-profiles.nix

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,24 @@
66
...
77
}:
88
with lib; let
9-
cfg = config.nixflix.recyclarr;
9+
inherit (config) nixflix;
10+
cfg = nixflix.recyclarr;
1011

1112
sonarrBaseUrl =
1213
optionalString cfg.sonarr.enable
13-
"http://127.0.0.1:${toString config.nixflix.sonarr.config.hostConfig.port}${toString config.nixflix.sonarr.config.hostConfig.urlBase}";
14+
"http://127.0.0.1:${toString nixflix.sonarr.config.hostConfig.port}${toString nixflix.sonarr.config.hostConfig.urlBase}";
1415

1516
radarrBaseUrl =
1617
optionalString cfg.radarr.enable
17-
"http://127.0.0.1:${toString config.nixflix.radarr.config.hostConfig.port}${toString config.nixflix.radarr.config.hostConfig.urlBase}";
18+
"http://127.0.0.1:${toString nixflix.radarr.config.hostConfig.port}${toString nixflix.radarr.config.hostConfig.urlBase}";
1819

1920
sonarrApiVersion =
2021
if cfg.sonarr.enable
21-
then config.nixflix.sonarr.config.apiVersion
22+
then nixflix.sonarr.config.apiVersion
2223
else "v3";
2324
radarrApiVersion =
2425
if cfg.radarr.enable
25-
then config.nixflix.radarr.config.apiVersion
26+
then nixflix.radarr.config.apiVersion
2627
else "v3";
2728

2829
buildInstanceConfigs = serviceType: baseUrl: apiVersion: instances:
@@ -194,8 +195,8 @@ in {
194195
PrivateDevices = true;
195196

196197
LoadCredential =
197-
optional cfg.radarr.enable "radarr-api_key:${config.nixflix.radarr.config.apiKeyPath}"
198-
++ optional cfg.sonarr.enable "sonarr-api_key:${config.nixflix.sonarr.config.apiKeyPath}";
198+
optional cfg.radarr.enable "radarr-api_key:${nixflix.radarr.config.apiKeyPath}"
199+
++ optional cfg.sonarr.enable "sonarr-api_key:${nixflix.sonarr.config.apiKeyPath}";
199200
};
200201
};
201202
}

0 commit comments

Comments
 (0)