inherit types in jellyfin module

This commit is contained in:
ibizaman 2025-06-29 11:52:36 +02:00
parent 3a1047a900
commit 5cb1e073f3

View file

@ -1,6 +1,8 @@
{ config, lib, pkgs, ...}: { config, lib, pkgs, ...}:
let let
inherit (lib) types;
cfg = config.shb.jellyfin; cfg = config.shb.jellyfin;
contracts = pkgs.callPackage ../contracts {}; contracts = pkgs.callPackage ../contracts {};
@ -13,63 +15,63 @@ in
enable = lib.mkEnableOption "shb jellyfin"; enable = lib.mkEnableOption "shb jellyfin";
subdomain = lib.mkOption { subdomain = lib.mkOption {
type = lib.types.str; type = types.str;
description = "Subdomain under which home-assistant will be served."; description = "Subdomain under which home-assistant will be served.";
example = "jellyfin"; example = "jellyfin";
}; };
domain = lib.mkOption { domain = lib.mkOption {
description = "Domain to serve sites under."; description = "Domain to serve sites under.";
type = lib.types.str; type = types.str;
example = "domain.com"; example = "domain.com";
}; };
ssl = lib.mkOption { ssl = lib.mkOption {
description = "Path to SSL files"; description = "Path to SSL files";
type = lib.types.nullOr contracts.ssl.certs; type = types.nullOr contracts.ssl.certs;
default = null; default = null;
}; };
ldap = lib.mkOption { ldap = lib.mkOption {
description = "LDAP configuration."; description = "LDAP configuration.";
default = {}; default = {};
type = lib.types.submodule { type = types.submodule {
options = { options = {
enable = lib.mkEnableOption "LDAP"; enable = lib.mkEnableOption "LDAP";
host = lib.mkOption { host = lib.mkOption {
type = lib.types.str; type = types.str;
description = "Host serving the LDAP server."; description = "Host serving the LDAP server.";
example = "127.0.0.1"; example = "127.0.0.1";
}; };
port = lib.mkOption { port = lib.mkOption {
type = lib.types.int; type = types.int;
description = "Port where the LDAP server is listening."; description = "Port where the LDAP server is listening.";
example = 389; example = 389;
}; };
dcdomain = lib.mkOption { dcdomain = lib.mkOption {
type = lib.types.str; type = types.str;
description = "DC domain for LDAP."; description = "DC domain for LDAP.";
example = "dc=mydomain,dc=com"; example = "dc=mydomain,dc=com";
}; };
userGroup = lib.mkOption { userGroup = lib.mkOption {
type = lib.types.str; type = types.str;
description = "LDAP user group"; description = "LDAP user group";
default = "jellyfin_user"; default = "jellyfin_user";
}; };
adminGroup = lib.mkOption { adminGroup = lib.mkOption {
type = lib.types.str; type = types.str;
description = "LDAP admin group"; description = "LDAP admin group";
default = "jellyfin_admin"; default = "jellyfin_admin";
}; };
adminPassword = lib.mkOption { adminPassword = lib.mkOption {
description = "LDAP admin password."; description = "LDAP admin password.";
type = lib.types.submodule { type = types.submodule {
options = contracts.secret.mkRequester { options = contracts.secret.mkRequester {
mode = "0440"; mode = "0440";
owner = "jellyfin"; owner = "jellyfin";
@ -85,49 +87,49 @@ in
sso = lib.mkOption { sso = lib.mkOption {
description = "SSO configuration."; description = "SSO configuration.";
default = {}; default = {};
type = lib.types.submodule { type = types.submodule {
options = { options = {
enable = lib.mkEnableOption "SSO"; enable = lib.mkEnableOption "SSO";
provider = lib.mkOption { provider = lib.mkOption {
type = lib.types.str; type = types.str;
description = "OIDC provider name"; description = "OIDC provider name";
default = "Authelia"; default = "Authelia";
}; };
endpoint = lib.mkOption { endpoint = lib.mkOption {
type = lib.types.str; type = types.str;
description = "OIDC endpoint for SSO"; description = "OIDC endpoint for SSO";
example = "https://authelia.example.com"; example = "https://authelia.example.com";
}; };
clientID = lib.mkOption { clientID = lib.mkOption {
type = lib.types.str; type = types.str;
description = "Client ID for the OIDC endpoint"; description = "Client ID for the OIDC endpoint";
default = "jellyfin"; default = "jellyfin";
}; };
adminUserGroup = lib.mkOption { adminUserGroup = lib.mkOption {
type = lib.types.str; type = types.str;
description = "OIDC admin group"; description = "OIDC admin group";
default = "jellyfin_admin"; default = "jellyfin_admin";
}; };
userGroup = lib.mkOption { userGroup = lib.mkOption {
type = lib.types.str; type = types.str;
description = "OIDC user group"; description = "OIDC user group";
default = "jellyfin_user"; default = "jellyfin_user";
}; };
authorization_policy = lib.mkOption { authorization_policy = lib.mkOption {
type = lib.types.enum [ "one_factor" "two_factor" ]; type = types.enum [ "one_factor" "two_factor" ];
description = "Require one factor (password) or two factor (device) authentication."; description = "Require one factor (password) or two factor (device) authentication.";
default = "one_factor"; default = "one_factor";
}; };
sharedSecret = lib.mkOption { sharedSecret = lib.mkOption {
description = "OIDC shared secret for Jellyfin."; description = "OIDC shared secret for Jellyfin.";
type = lib.types.submodule { type = types.submodule {
options = contracts.secret.mkRequester { options = contracts.secret.mkRequester {
mode = "0440"; mode = "0440";
owner = "jellyfin"; owner = "jellyfin";
@ -139,7 +141,7 @@ in
sharedSecretForAuthelia = lib.mkOption { sharedSecretForAuthelia = lib.mkOption {
description = "OIDC shared secret for Authelia."; description = "OIDC shared secret for Authelia.";
type = lib.types.submodule { type = types.submodule {
options = contracts.secret.mkRequester { options = contracts.secret.mkRequester {
mode = "0400"; mode = "0400";
owner = config.shb.authelia.autheliaUser; owner = config.shb.authelia.autheliaUser;
@ -155,7 +157,7 @@ in
Backup configuration. Backup configuration.
''; '';
default = {}; default = {};
type = lib.types.submodule { type = types.submodule {
options = contracts.backup.mkRequester { options = contracts.backup.mkRequester {
user = "jellyfin"; user = "jellyfin";
sourceDirectories = [ sourceDirectories = [