added network config options

TODO: Make testcases so we can test if this creates the correct XML
This commit is contained in:
Snorre Ettrup Altschul 2025-04-03 01:58:54 +02:00
parent 0e706bed3e
commit 4c9052b18c
5 changed files with 112 additions and 17 deletions

View file

@ -1,4 +1,3 @@
{lib, ...}:
with lib; {
}

View file

@ -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);
}
);
}

View file

@ -1,4 +1,3 @@
{lib, ...}:
with lib; {
}

View file

@ -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";
};
}

View file

@ -1,4 +1,3 @@
{lib, ...}:
with lib; {
}