Created module for caddy with plugins

This commit is contained in:
pazpi 2024-09-10 19:48:40 +02:00
parent ecbf722032
commit f4935560a4
3 changed files with 100 additions and 34 deletions

View file

@ -3,46 +3,53 @@
with pkgs;
caddy.override {
buildGoModule = args: buildGoModule (args // {
src = stdenv.mkDerivation rec {
pname = "caddy-using-xcaddy-${xcaddy.version}";
inherit (caddy) version;
buildGoModule =
args:
buildGoModule (
args
// {
src = stdenv.mkDerivation rec {
pname = "caddy-using-xcaddy-${xcaddy.version}";
inherit (caddy) version;
dontUnpack = true;
dontFixup = true;
dontUnpack = true;
dontFixup = true;
nativeBuildInputs = [
cacert
go
];
nativeBuildInputs = [
cacert
go
];
plugins = [
# https://github.com/caddy-dns/cloudflare
"github.com/caddy-dns/cloudflare@89f16b99c18ef49c8bb470a82f895bce01cbaece"
];
plugins = [ "github.com/caddy-dns/cloudflare@89f16b99c18ef49c8bb470a82f895bce01cbaece" ];
configurePhase = ''
export GOCACHE=$TMPDIR/go-cache
export GOPATH="$TMPDIR/go"
export XCADDY_SKIP_BUILD=1
'';
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
'';
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
'';
installPhase = ''
cp -r --reflink=auto . $out
'';
outputHash = "sha256-lyhEIOgGkR31bt9YV+W854TBZw419G8uuTtBSsFcgCA=";
outputHashMode = "recursive";
};
outputHash = "sha256-lyhEIOgGkR31bt9YV+W854TBZw419G8uuTtBSsFcgCA=";
outputHashMode = "recursive";
};
subPackages = [ "." ];
ldflags = [ "-s" "-w" ]; ## don't include version info twice
vendorHash = null;
});
subPackages = [ "." ];
ldflags = [
"-s"
"-w"
]; # # don't include version info twice
vendorHash = null;
}
);
}