Skip to content

Commit 0e4844b

Browse files
authored
simplify extra services for arr modules (#130)
* simplify extra services for arr modules * add wait for api to jellyfin setupwizardservice * increase timeout for jellyfin startup
1 parent 266fa18 commit 0e4844b

10 files changed

Lines changed: 382 additions & 352 deletions

File tree

modules/arr-common/mkArrServiceModule.nix

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
pkgs,
55
...
66
}:
7-
serviceName: extraConfigOptions:
7+
serviceName:
88
with lib;
99
let
1010
secrets = import ../../lib/secrets { inherit lib; };
@@ -177,7 +177,6 @@ in
177177
description = "API key for ${capitalizedName}.";
178178
};
179179
}
180-
// extraConfigOptions
181180
// {
182181
hostConfig = hostConfig.options;
183182
}

modules/jellyfin/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ in
151151
Group = cfg.group;
152152
WorkingDirectory = cfg.dataDir;
153153
Restart = "on-failure";
154-
TimeoutStartSec = 120;
154+
TimeoutStartSec = 300;
155155
TimeoutStopSec = 15;
156156
SuccessExitStatus = "0 143";
157157

modules/jellyfin/setupWizardService.nix

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@ in
4545
4646
BASE_URL="${baseUrl}"
4747
48+
echo "Waiting for Jellyfin API to be available..."
49+
for attempt in {1..90}; do
50+
if ${pkgs.curl}/bin/curl -sf "$BASE_URL/System/Info/Public" >/dev/null 2>&1; then
51+
echo "Jellyfin API is available"
52+
break
53+
fi
54+
if [[ $attempt -eq 90 ]]; then
55+
echo "Jellyfin API did not become available after 90 attempts" >&2
56+
exit 1
57+
fi
58+
sleep 2
59+
done
60+
4861
echo "Checking if first admin user needs to be created..."
4962
5063
# Check if startup wizard is already completed via API

modules/lidarr.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let
1010
in
1111
{
1212
imports = [
13-
(import ./arr-common/mkArrServiceModule.nix { inherit config lib pkgs; } "lidarr" { })
13+
(import ./arr-common/mkArrServiceModule.nix { inherit config lib pkgs; } "lidarr")
1414
];
1515

1616
config.nixflix.lidarr = {

0 commit comments

Comments
 (0)