1
0
Fork 0
selfhostblocks/test/services/jellyfin.nix

144 lines
2.9 KiB
Nix
Raw Permalink Normal View History

2024-07-16 10:38:26 +02:00
{ pkgs, ... }:
let
2024-03-20 06:50:41 +01:00
pkgs' = pkgs;
2024-07-12 13:01:26 +02:00
testLib = pkgs.callPackage ../common.nix {};
subdomain = "j";
domain = "example.com";
commonTestScript = testLib.accessScript {
2024-07-16 10:38:26 +02:00
inherit subdomain domain;
2024-07-12 13:01:26 +02:00
hasSSL = { node, ... }: !(isNull node.config.shb.jellyfin.ssl);
waitForServices = { ... }: [
"jellyfin.service"
"nginx.service"
];
waitForPorts = { node, ... }: [
8096
];
};
2024-07-16 10:38:26 +02:00
base = testLib.base pkgs' [
../../modules/services/jellyfin.nix
];
basic = {
shb.jellyfin = {
enable = true;
inherit domain subdomain;
};
};
https = { config, ... }: {
shb.jellyfin = {
ssl = config.shb.certs.certs.selfsigned.n;
};
};
ldap = { config, ... }: {
shb.jellyfin = {
ldap = {
enable = true;
host = "127.0.0.1";
port = config.shb.ldap.ldapPort;
dcdomain = config.shb.ldap.dcdomain;
adminPassword.result.path = config.shb.hardcodedsecret.jellyfinLdapUserPassword.path;
2024-07-16 10:38:26 +02:00
};
};
shb.hardcodedsecret.jellyfinLdapUserPassword = config.shb.jellyfin.ldap.adminPassword.request // {
content = "ldapUserPassword";
};
2024-07-16 10:38:26 +02:00
};
sso = { config, ... }: {
shb.jellyfin = {
sso = {
enable = true;
endpoint = "https://${config.shb.authelia.subdomain}.${config.shb.authelia.domain}";
sharedSecret.result.path = config.shb.hardcodedsecret.jellyfinSSOPassword.path;
sharedSecretForAuthelia.result.path = config.shb.hardcodedsecret.jellyfinSSOPasswordAuthelia.path;
2024-07-16 10:38:26 +02:00
};
};
shb.hardcodedsecret.jellyfinSSOPassword = config.shb.jellyfin.sso.sharedSecret.request // {
content = "ssoPassword";
};
shb.hardcodedsecret.jellyfinSSOPasswordAuthelia = config.shb.jellyfin.sso.sharedSecretForAuthelia.request // {
content = "ssoPassword";
};
2024-07-16 10:38:26 +02:00
};
in
{
2024-03-20 06:50:41 +01:00
basic = pkgs.testers.runNixOSTest {
2024-07-16 10:38:26 +02:00
name = "jellyfin_basic";
2024-07-16 10:38:26 +02:00
nodes.server = {
imports = [
2024-07-16 10:38:26 +02:00
base
basic
];
};
nodes.client = {};
testScript = commonTestScript;
};
2024-07-16 10:38:26 +02:00
https = pkgs.testers.runNixOSTest {
name = "jellyfin_https";
2024-07-16 10:38:26 +02:00
nodes.server = {
imports = [
2024-07-16 10:38:26 +02:00
base
(testLib.certs domain)
basic
https
];
};
nodes.client = {};
testScript = commonTestScript;
};
2024-07-16 10:38:26 +02:00
ldap = pkgs.testers.runNixOSTest {
name = "jellyfin_ldap";
2024-07-16 10:38:26 +02:00
nodes.server = {
imports = [
2024-07-16 10:38:26 +02:00
base
basic
(testLib.ldap domain pkgs')
ldap
];
};
2024-07-16 10:38:26 +02:00
nodes.client = {};
2024-07-16 10:38:26 +02:00
testScript = commonTestScript;
};
2024-03-20 06:50:41 +01:00
sso = pkgs.testers.runNixOSTest {
name = "jellyfin_sso";
nodes.server = { config, pkgs, ... }: {
imports = [
2024-07-16 10:38:26 +02:00
base
(testLib.certs domain)
basic
https
(testLib.ldap domain pkgs')
(testLib.sso domain pkgs' config.shb.certs.certs.selfsigned.n)
sso
];
};
nodes.client = {};
testScript = commonTestScript;
};
}