From 6815af21dc396d6f5b2a0da60708fd61680b0136 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Thu, 1 Jun 2023 12:18:38 +0000 Subject: [PATCH] clean up custom caddy build --- modules/nixos/services/cloudflare.nix | 9 ++++----- overlays/{custom-caddy.nix => caddy.nix} | 7 ++++--- 2 files changed, 8 insertions(+), 8 deletions(-) rename overlays/{custom-caddy.nix => caddy.nix} (86%) diff --git a/modules/nixos/services/cloudflare.nix b/modules/nixos/services/cloudflare.nix index 800565c..0df2068 100644 --- a/modules/nixos/services/cloudflare.nix +++ b/modules/nixos/services/cloudflare.nix @@ -50,11 +50,10 @@ in { }]; # Tell Caddy to use Cloudflare DNS for ACME challenge validation - services.caddy.package = - (pkgs.callPackage ../../../overlays/custom-caddy.nix { - plugins = [ "github.com/caddy-dns/cloudflare" ]; - # vendorSha256 = "sha256-K9HPZnr+hMcK5aEd1H4gEg6PXAaNrNWFvaHYm5m62JY="; - }); + services.caddy.package = (pkgs.callPackage ../../../overlays/caddy.nix { + plugins = [ "github.com/caddy-dns/cloudflare" ]; + # vendorSha256 = "sha256-K9HPZnr+hMcK5aEd1H4gEg6PXAaNrNWFvaHYm5m62JY="; + }); caddy.tlsPolicies = [{ issuers = [{ module = "acme"; diff --git a/overlays/custom-caddy.nix b/overlays/caddy.nix similarity index 86% rename from overlays/custom-caddy.nix rename to overlays/caddy.nix index 4f7cb7e..966d681 100644 --- a/overlays/custom-caddy.nix +++ b/overlays/caddy.nix @@ -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/"; });