clean up custom caddy build

This commit is contained in:
Noah Masur 2023-06-01 12:18:38 +00:00
parent 3269d5e247
commit 6815af21dc
2 changed files with 8 additions and 8 deletions

View File

@ -50,11 +50,10 @@ in {
}]; }];
# Tell Caddy to use Cloudflare DNS for ACME challenge validation # Tell Caddy to use Cloudflare DNS for ACME challenge validation
services.caddy.package = services.caddy.package = (pkgs.callPackage ../../../overlays/caddy.nix {
(pkgs.callPackage ../../../overlays/custom-caddy.nix { plugins = [ "github.com/caddy-dns/cloudflare" ];
plugins = [ "github.com/caddy-dns/cloudflare" ]; # vendorSha256 = "sha256-K9HPZnr+hMcK5aEd1H4gEg6PXAaNrNWFvaHYm5m62JY=";
# vendorSha256 = "sha256-K9HPZnr+hMcK5aEd1H4gEg6PXAaNrNWFvaHYm5m62JY="; });
});
caddy.tlsPolicies = [{ caddy.tlsPolicies = [{
issuers = [{ issuers = [{
module = "acme"; module = "acme";

View File

@ -1,12 +1,13 @@
{ lib, buildGo118Module, fetchFromGitHub, plugins ? [ ] }: { lib, buildGo118Module, fetchFromGitHub, plugins ? [ ] }:
let let
imports = lib.flip lib.concatMapStrings plugins (pkg: " _ \"${pkg}\"\n"); goImports = lib.flip lib.concatMapStrings plugins (pkg: " _ \"${pkg}\"\n");
goGets = lib.flip lib.concatMapStrings plugins (pkg: "go get ${pkg}\n ");
main = '' main = ''
package main package main
import ( import (
caddycmd "github.com/caddyserver/caddy/v2/cmd" caddycmd "github.com/caddyserver/caddy/v2/cmd"
_ "github.com/caddyserver/caddy/v2/modules/standard" _ "github.com/caddyserver/caddy/v2/modules/standard"
${imports} ${goImports}
) )
func main() { func main() {
caddycmd.Main() caddycmd.Main()
@ -31,7 +32,7 @@ in buildGo118Module rec {
overrideModAttrs = (_: { overrideModAttrs = (_: {
preBuild = '' preBuild = ''
echo '${main}' > cmd/caddy/main.go echo '${main}' > cmd/caddy/main.go
go get github.com/caddy-dns/cloudflare ${goGets}
''; '';
postInstall = "cp go.sum go.mod $out/ && ls $out/"; postInstall = "cp go.sum go.mod $out/ && ls $out/";
}); });