Replace custom xcaddy with the new one in nixpkgs

This commit is contained in:
batteredbunny 2025-01-15 02:39:07 +02:00
parent 7bc3e3bddf
commit 91d56f4b34
2 changed files with 6 additions and 41 deletions

View file

@ -1,38 +0,0 @@
# copied from here https://github.com/jdheyburn/nixos-configs/blob/932fa64615db39979694c761174ea3b83d4b5e94/modules/caddy/custom-caddy.nix
# https://mdleom.com/blog/2021/12/27/caddy-plugins-nixos/#xcaddy
{ pkgs, plugins, stdenv, lib, ... }:
stdenv.mkDerivation rec {
pname = "caddy";
# https://github.com/NixOS/nixpkgs/issues/113520
version = "2.8.4";
dontUnpack = true;
nativeBuildInputs = with pkgs; [ git go xcaddy ];
configurePhase = ''
export GOCACHE=$TMPDIR/go-cache
export GOPATH="$TMPDIR/go"
'';
buildPhase =
let
pluginArgs =
lib.concatMapStringsSep " " (plugin: "--with ${plugin}") plugins;
in
''
runHook preBuild
${pkgs.xcaddy}/bin/xcaddy build "v${version}" ${pluginArgs}
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
mv caddy $out/bin
runHook postInstall
'';
meta.mainProgram = "caddy";
}

View file

@ -2,6 +2,7 @@
, pkgs , pkgs
, inputs , inputs
, settings , settings
, lib
, ... , ...
}: }:
let let
@ -36,9 +37,11 @@ in
enable = true; enable = true;
email = "ssl@catnip.ee"; email = "ssl@catnip.ee";
package = (pkgs.callPackage ./custom-caddy.nix { package = pkgs.caddy.withPlugins {
plugins = [ "github.com/caddy-dns/cloudflare" ]; # https://github.com/NixOS/nixpkgs/pull/358586#issuecomment-2564016652
}); plugins = [ "github.com/caddy-dns/cloudflare@v0.0.0-20240703190432-89f16b99c18e" ];
hash = "sha256-JoujVXRXjKUam1Ej3/zKVvF0nX97dUizmISjy3M3Kr8=";
};
globalConfig = '' globalConfig = ''
servers { servers {