Clean up caddy module

This commit is contained in:
pazpi 2025-09-29 18:29:17 +02:00
parent ae2bf387f5
commit 67483e3373
6 changed files with 31 additions and 272 deletions

View file

@ -111,21 +111,12 @@ in
services.caddy = {
enable = true;
# Waiting for https://github.com/NixOS/nixpkgs/issues/14671 to be released
package = pkgs.callPackage ../../packages/caddy.nix {
externalPlugins = [
{
name = "cloudflare";
repo = "github.com/caddy-dns/cloudflare";
version = "188b4850c0f2f5565a6310810c936ea960e2210f";
}
{
name = "dynamicdns";
repo = "github.com/mholt/caddy-dynamicdns";
version = "7c818ab3fc3485a72a346f85c77810725f19f9cf";
}
package = pkgs.caddy.withPlugins {
hash = "sha256-OjDL7n9cLtguqtiKO9uYYac2INzP9XazkjNfghJ0j/o=";
plugins = [
"github.com/caddy-dns/cloudflare@v0.2.2-0.20250724223520-f589a18c0f5d"
"github.com/mholt/caddy-dynamicdns@v0.0.0-20250430031602-b846b9e8fb83"
];
vendorHash = "sha256-7JfEZjHeQ8F/+OltCrBUO/Cf8+GwF9d3UDcSd17pcxU=";
};
globalConfig = ''

View file

@ -20,22 +20,6 @@ in
'';
};
enableAI = lib.mkOption {
default = false;
type = lib.types.bool;
description = ''
Enable alternative search engine with AI. Requires [Perplexica](https://github.com/ItzCrazyKns/Perplexica)
'';
};
perplexicaUrl = lib.mkOption {
default = "";
type = lib.types.str;
description = ''
URL to the Perplexica instance. It assumes that the Perplexica instance is running on port 3000 and the API on port 3001
'';
};
proxy = {
enable = lib.mkEnableOption "Set the proxy entry for this service";
@ -114,21 +98,6 @@ in
import cloudflare_${domain}
'';
virtualHosts."${perplexicaSubdomain}.${domain}".extraConfig = lib.mkIf cfg.enableAI ''
@websockets {
header Connection *Upgrade*
header Upgrade websocket
}
reverse_proxy ${cfg.perplexicaUrl}:3000
reverse_proxy /api* ${cfg.perplexicaUrl}:3001
reverse_proxy @websockets {
header_up Host ${cfg.perplexicaUrl}
to ${cfg.perplexicaUrl}:3001
}
import cloudflare_${domain}
'';
};
})
];