really loving clan!

This commit is contained in:
Chris Kruining 2026-04-02 17:24:18 +02:00
parent a8a639db6e
commit d60d4badf3
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
15 changed files with 474 additions and 81 deletions

View file

@ -1,8 +1,11 @@
{
exports,
clanLib,
lib,
...
}: {
}: let
inherit (lib) toString;
in {
_class = "clan.service";
manifest = {
name = "arda/servarr";
@ -10,8 +13,8 @@
categories = ["Service" "Media"];
readme = builtins.readFile ./README.md;
exports = {
inputs = [];
out = ["servarr" "persistence"];
inputs = ["persistence"];
out = ["gateway" "persistence"];
};
};
@ -24,13 +27,8 @@
options = {
enable = mkEnableOption "Enable configured *arr services";
database = {
host = mkOption {
type = types.str;
};
port = mkOption {
type = types.port;
};
persistence_instance = mkOption {
type = types.str;
};
services = mkOption {
@ -62,17 +60,25 @@
...
}: {
exports = mkExports {
# endpoints.hosts =
# settings.services
# |> lib.attrNames
# |> (s: lib.concat s ["sabnzbd" "qbittorrent" "flaresolverr"])
# |> lib.map (service: "${service}.${machine.name}.arda");
persistence.databases =
settings.services
|> lib.attrNames;
servarr.services =
gateway.services =
settings.services
|> lib.attrNames
|> lib.concat ["sabnzbd" "qbittorrent" "flaresolverr"]
# |> (s: lib.concat s ["sabnzbd" "qbittorrent" "flaresolverr"])
|> lib.imap1 (i: name: {
inherit name;
value = {port = 2000 + i;};
value = {
port = 2000 + i;
};
})
|> lib.listToAttrs;
};
@ -83,9 +89,20 @@
pkgs,
...
}: let
servarr = import ./lib.nix (args // {inherit settings;});
services = settings.services |> lib.attrNames;
service_count = services |> lib.length;
database =
exports
|> clanLib.getExport {
serviceName = "arda/persistence";
roleName = "default";
machineName = machine.name;
instanceName = settings.persistence_instance;
}
|> (v: v.persistence.driver.postgresql);
servarr = import ./lib.nix (args // {inherit settings database;});
in {
imports = [
(import ./sabnzbd.nix (args

View file

@ -4,6 +4,7 @@
lib,
pkgs,
settings,
database,
...
}: let
inherit (lib) mkIf;
@ -51,7 +52,7 @@
in
{
enable = true;
openFirewall = true;
# openFirewall = true;
environmentFiles = [
config.clan.core.vars.generators.${service}.files."config.env".path
@ -61,14 +62,14 @@
auth.authenticationMethod = "External";
server = {
bindaddress = "0.0.0.0";
bindaddress = "[::1]";
port = options.port;
};
# Password provided via environment file
postgres = {
host = settings.database.host;
port = toString settings.database.port;
host = database.host;
port = toString database.port;
user = service;
maindb = service;
logdb = service;
@ -322,6 +323,10 @@ in {
clan.core.vars.generators.${service} = createGenerator (args // {inherit service options;});
services.${service} = createService (args // {inherit service options;});
# services.caddy.virtualHosts."${service}.ulmo.arda".extraConfig = ''
# reverse_proxy http://[::1]:${toString options.port}
# '';
systemd.services."${service}-apply-infra" = lib.mkIf settings.enable (createSystemdService (args // {inherit service options;}));
})
|> lib.mkMerge;