45 lines
1.1 KiB
Nix
45 lines
1.1 KiB
Nix
{ lib, caddy, buildGoModule, stdenv, xcaddy, cacert, git, go, ... }:
|
|
caddy.override {
|
|
buildGo125Module = args: buildGoModule (args // {
|
|
src = stdenv.mkDerivation rec {
|
|
pname = "caddy-using-xcaddy-${xcaddy.version}";
|
|
inherit (caddy) version;
|
|
|
|
dontUnpack = true;
|
|
dontFixup = true;
|
|
|
|
nativeBuildInputs = [
|
|
cacert
|
|
git
|
|
go
|
|
];
|
|
|
|
plugins = [
|
|
"github.com/caddy-dns/desec@v1.0.1"
|
|
];
|
|
|
|
configurePhase = ''
|
|
export GOCACHE=$TMPDIR/go-cache
|
|
export GOPATH="$TMPDIR/go"
|
|
export XCADDY_SKIP_BUILD=1
|
|
'';
|
|
|
|
buildPhase = ''
|
|
${xcaddy}/bin/xcaddy build "${lib.last (lib.splitString "/" caddy.src.rev)}" ${lib.concatMapStringsSep " " (plugin: "--with ${plugin}") plugins}
|
|
cd buildenv*
|
|
go mod vendor
|
|
'';
|
|
|
|
installPhase = ''
|
|
cp -r --reflink=auto . $out
|
|
'';
|
|
|
|
outputHash = "sha256-sN3khgPLbBxhRohE+KXPNPFDowHJN5q/5J5uJ6wzLT8=";
|
|
outputHashMode = "recursive";
|
|
};
|
|
|
|
subPackages = [ "." ];
|
|
ldflags = [ "-s" "-w" ]; ## don't include version info twice
|
|
vendorHash = null;
|
|
});
|
|
}
|