diff --git a/modules/options/branding.nix b/modules/options/branding.nix index c676413..e36b4da 100644 --- a/modules/options/branding.nix +++ b/modules/options/branding.nix @@ -1,4 +1,3 @@ {lib, ...}: with lib; { - } diff --git a/modules/options/default.nix b/modules/options/default.nix index 48e552a..e82ca2a 100644 --- a/modules/options/default.nix +++ b/modules/options/default.nix @@ -1,14 +1,37 @@ -{lib, ...}: -with lib; { - imports = [ - ./system.nix - ./encoding.nix - ./network.nix - ./branding.nix - ]; - options.services.declarative-jellyfin = { - enable = mkEnableOption "Jellyfin Service"; +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.services.declarative-jellyfin; +in + with lib; { + imports = [ + ./system.nix + ./encoding.nix + ./network.nix + ./branding.nix + ]; + options.services.declarative-jellyfin = { + enable = mkEnableOption "Jellyfin Service"; + }; - # TODO: implement options - }; -} + config = + mkIf cfg.enable + ( + let + toXml = name: x: (toXMLGeneric { + inherit name; + properties = { + "xmlns:xsi" = "http://www.w3.org/2001/XMLSchema-instance"; + "xmlns:xsd" = "http://www.w3.org/2001/XMLSchema"; + }; + content = x; + }); + in { + system.activationScripts."link-network-xml" = + lib.stringAfter ["var"] (toXml "NetworkConfiguration" cfg.network); + } + ); + } diff --git a/modules/options/encoding.nix b/modules/options/encoding.nix index c676413..e36b4da 100644 --- a/modules/options/encoding.nix +++ b/modules/options/encoding.nix @@ -1,4 +1,3 @@ {lib, ...}: with lib; { - } diff --git a/modules/options/network.nix b/modules/options/network.nix index c676413..6fe9831 100644 --- a/modules/options/network.nix +++ b/modules/options/network.nix @@ -1,4 +1,79 @@ {lib, ...}: with lib; { - + options.services.declarative-jellyfin.network = { + BaseUrl = mkOption { + type = types.str; + }; + EnableHttps = mkEnableOption "Enable HTTPS"; + RequireHttps = mkEnableOption "Require HTTPS"; + CertificatePath = mkOption { + type = with types; either str path; + description = "Path to the certificate file"; + }; + CertificatePassword = mkOption { + type = types.str; + description = "Password for the certificate"; + }; + InternalHttpPort = mkOption { + type = types.port; + description = "The internal HTTP port jellyfin is run at"; + }; + InternalHttpsPort = mkOption { + type = types.port; + description = "The internal HTTPS port jellyfin is run at"; + }; + PublicHttpPort = mkOption { + type = types.port; + description = "The public HTTP port jellyfin is run at"; + }; + PublicHttpsPort = mkOption { + type = types.port; + description = "The public HTTPS port jellyfin is run at"; + }; + AutoDiscovery = mkOption { + type = types.bool; + default = true; + description = "Enable auto discovery"; + }; + EnableUPnP = mkEnableOption "Enable UPnP forwarding"; + EnableIPv4 = mkOption { + type = types.bool; + default = true; + description = "Enable IPv4 routing"; + }; + EnableIPv6 = mkOption { + type = types.bool; + default = false; + description = "Enable IPv6 routing"; + }; + EnableRemoteAccess = mkOption { + type = types.bool; + default = true; + description = "Enable remote access"; + }; + LocalNetworkSubnets = mkEnableOption "UNIMPLEMENTED"; + LocalNetworkAddresses = mkEnableOption "UNIMPLEMENTED"; + KnownProxies = mkOption { + type = with types; listOf str; + description = "A list of known proxies"; + default = []; + }; + IgnoreVirtualInterfaces = mkOption { + type = types.bool; + default = true; + description = "Ignore virtual interfaces"; + }; + VirtualInterfaceNames = mkOption { + type = with types; listOf str; + description = "List of virtual interface names"; + default = ["veth"]; + }; + EnablePublishedServerUriByRequest = mkEnableOption "Enable published server uri by request"; + PublishedServerUriBySubnet = mkEnableOption "UNIMPLEMENTED"; + RemoteIpFilter = mkOption { + type = types.str; + description = "Remote ip filter"; + }; + IsRemoteIPFilterBlacklist = mkEnableOption "Is the remote ip filter list a blacklist or a whitelist"; + }; } diff --git a/modules/options/system.nix b/modules/options/system.nix index c676413..e36b4da 100644 --- a/modules/options/system.nix +++ b/modules/options/system.nix @@ -1,4 +1,3 @@ {lib, ...}: with lib; { - }