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,8 +50,7 @@ in {
}];
# Tell Caddy to use Cloudflare DNS for ACME challenge validation
services.caddy.package =
(pkgs.callPackage ../../../overlays/custom-caddy.nix {
services.caddy.package = (pkgs.callPackage ../../../overlays/caddy.nix {
plugins = [ "github.com/caddy-dns/cloudflare" ];
# vendorSha256 = "sha256-K9HPZnr+hMcK5aEd1H4gEg6PXAaNrNWFvaHYm5m62JY=";
});

View File

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