diff --git a/hosts/caddy/default.nix b/hosts/caddy/default.nix index a59e172..444ca9e 100644 --- a/hosts/caddy/default.nix +++ b/hosts/caddy/default.nix @@ -35,10 +35,10 @@ in }; dashy = { - enable = true; + enable = false; settings = import ./dashy-settings.nix; proxy = { - enable = true; + enable = false; domain = p.domains.public; host = p.hosts.caddy; }; @@ -56,35 +56,27 @@ in host = p.hosts.immich; }; - media-mgr = { - proxy = { - enable = true; - domain = p.domains.public; - host = p.hosts.arr; - }; + media-mgr.proxy = { + enable = true; + domain = p.domains.public; + host = p.hosts.arr; }; - nextcloud = { - proxy = { - enable = true; - domain = p.domains.public; - host = p.hosts.nextcloud; - }; + nextcloud.proxy = { + enable = true; + domain = p.domains.public; + host = p.hosts.nextcloud; }; - paperless = { - proxy = { - enable = true; - domain = p.domains.public; - host = p.hosts.paperless; - }; + paperless.proxy = { + enable = true; + domain = p.domains.public; + host = p.hosts.paperless; }; searx = { enable = true; secretFile = config.age.secrets.searx-secret.path; - enableAI = true; - perplexicaUrl = p.hosts.portainer; proxy = { enable = true; domain = p.domains.public; @@ -92,31 +84,24 @@ in }; }; - vaultwarden = { - proxy = { - enable = true; - domain = p.domains.public; - host = p.hosts.vaultwarden; - }; - + vaultwarden.proxy = { + enable = true; + domain = p.domains.public; + host = p.hosts.vaultwarden; }; }; monitoring = { - prometheus = { - proxy = { - enable = true; - domain = p.domains.public; - host = p.hosts.metrics; - }; + prometheus.proxy = { + enable = true; + domain = p.domains.public; + host = p.hosts.metrics; }; - grafana = { - proxy = { - enable = true; - domain = p.domains.public; - host = p.hosts.metrics; - }; + grafana.proxy = { + enable = true; + domain = p.domains.public; + host = p.hosts.metrics; }; uptime-kuma.proxy = { diff --git a/modules/networking/caddy.nix b/modules/networking/caddy.nix index ad51fda..72ddd60 100644 --- a/modules/networking/caddy.nix +++ b/modules/networking/caddy.nix @@ -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 = '' diff --git a/modules/services/searx.nix b/modules/services/searx.nix index eae8310..5aad835 100644 --- a/modules/services/searx.nix +++ b/modules/services/searx.nix @@ -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} - ''; - }; }) ]; diff --git a/overlay/caddy-custom.nix b/overlay/caddy-custom.nix deleted file mode 100644 index 910d8bb..0000000 --- a/overlay/caddy-custom.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ pkgs, ... }: - -with pkgs; - -caddy.override { - buildGoModule = - args: - buildGoModule ( - args - // { - src = stdenv.mkDerivation rec { - pname = "caddy-using-xcaddy-${xcaddy.version}"; - inherit (caddy) version; - - dontUnpack = true; - dontFixup = true; - - nativeBuildInputs = [ - cacert - go - ]; - - plugins = [ "github.com/caddy-dns/cloudflare@89f16b99c18ef49c8bb470a82f895bce01cbaece" ]; - - configurePhase = '' - export GOCACHE=$TMPDIR/go-cache - export GOPATH="$TMPDIR/go" - export XCADDY_SKIP_BUILD=1 - ''; - - buildPhase = '' - ${xcaddy}/bin/xcaddy build "${caddy.src.rev}" ${ - lib.concatMapStringsSep " " (plugin: "--with ${plugin}") plugins - } - cd buildenv* - go mod vendor - ''; - - installPhase = '' - cp -r --reflink=auto . $out - ''; - - outputHash = "sha256-lyhEIOgGkR31bt9YV+W854TBZw419G8uuTtBSsFcgCA="; - outputHashMode = "recursive"; - }; - - subPackages = [ "." ]; - ldflags = [ - "-s" - "-w" - ]; # # don't include version info twice - vendorHash = null; - } - ); -} diff --git a/overlay/default.nix b/overlay/default.nix deleted file mode 100644 index e5f7337..0000000 --- a/overlay/default.nix +++ /dev/null @@ -1 +0,0 @@ -_: prev: { caddy-custom = prev.callPackage ./caddy-custom.nix { }; } diff --git a/packages/caddy.nix b/packages/caddy.nix deleted file mode 100644 index 308f5e3..0000000 --- a/packages/caddy.nix +++ /dev/null @@ -1,130 +0,0 @@ -{ - lib, - buildGoModule, - fetchFromGitHub, - gnused, - nixosTests, - caddy, - testers, - installShellFiles, - externalPlugins ? [ ], - vendorHash ? "sha256-G7danupoc7BRyJJWzzyRP6CSOShA+oCLcUWMCnrLF2c=", -}: - -let - attrsToModules = - attrs: - builtins.map ( - { - name, - repo, - version, - }: - "${repo}" - ) attrs; - attrsToSources = - attrs: - builtins.map ( - { - name, - repo, - version, - }: - "${repo}@${version}" - ) attrs; -in -buildGoModule rec { - pname = "caddy"; - version = "2.9.1"; - - dist = fetchFromGitHub { - owner = "caddyserver"; - repo = "dist"; - rev = "v${version}"; - hash = "sha256-O4s7PhSUTXoNEIi+zYASx8AgClMC5rs7se863G6w+l0="; - }; - - src = fetchFromGitHub { - owner = "caddyserver"; - repo = "caddy"; - rev = "v${version}"; - hash = "sha256-th0R3Q1nGT0q5PGOygtD1/CpJmrT5TYagrwQR4t/Fvg="; - }; - - inherit vendorHash; - - subPackages = [ "cmd/caddy" ]; - - ldflags = [ - "-s" - "-w" - "-X github.com/caddyserver/caddy/v2.CustomVersion=${version}" - ]; - - nativeBuildInputs = [ - gnused - installShellFiles - ]; - - modBuildPhase = '' - for module in ${builtins.toString (attrsToModules externalPlugins)}; do - sed -i "/standard/a _ \"$module\"" ./cmd/caddy/main.go - done - for plugin in ${builtins.toString (attrsToSources externalPlugins)}; do - go get $plugin - done - - go generate - go mod vendor - ''; - - modInstallPhase = '' - mv -t vendor go.mod go.sum - cp -r --reflink=auto vendor "$out" - ''; - - preBuild = '' - chmod -R u+w vendor - [ -f vendor/go.mod ] && mv -t . vendor/go.{mod,sum} - go generate - - for module in ${builtins.toString (attrsToModules externalPlugins)}; do - sed -i "/standard/a _ \"$module\"" ./cmd/caddy/main.go - done - ''; - - postInstall = '' - install -Dm644 ${dist}/init/caddy.service ${dist}/init/caddy-api.service -t $out/lib/systemd/system - - substituteInPlace $out/lib/systemd/system/caddy.service --replace "/usr/bin/caddy" "$out/bin/caddy" - substituteInPlace $out/lib/systemd/system/caddy-api.service --replace "/usr/bin/caddy" "$out/bin/caddy" - - $out/bin/caddy manpage --directory manpages - installManPage manpages/* - - installShellCompletion --cmd caddy \ - --bash <($out/bin/caddy completion bash) \ - --fish <($out/bin/caddy completion fish) \ - --zsh <($out/bin/caddy completion zsh) - ''; - - passthru.tests = { - inherit (nixosTests) caddy; - version = testers.testVersion { - command = "${caddy}/bin/caddy version"; - package = caddy; - }; - }; - - meta = with lib; { - homepage = "https://caddyserver.com"; - description = "Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS"; - license = licenses.asl20; - mainProgram = "caddy"; - maintainers = with maintainers; [ - Br1ght0ne - emilylange - techknowlogick - ]; - }; -}