fix: caddy compile

This commit is contained in:
Lucy Hochkamp 2024-03-17 09:18:12 +01:00
parent 422cefb45c
commit 3c2cfcd1d9
No known key found for this signature in database
3 changed files with 19 additions and 4 deletions

View file

@ -0,0 +1,48 @@
{ pkgs, ... }:
with pkgs;
caddy.override {
buildGoModule = args: buildGoModule (args // {
src = stdenv.mkDerivation rec {
pname = "caddy-using-xcaddy-${xcaddy.version}";
inherit (caddy) version;
dontUnpack = true;
dontFixup = true;
nativeBuildInputs = [
cacert
go
];
plugins = [
"github.com/caddy-dns/ionos@751e8e24162290ee74bea465ae733a2bf49551a6"
"github.com/caddy-dns/desec@e1e64971fe34c29ce3f4176464adb84d6890aa50"
];
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
'';
installPhase = ''
cp -r --reflink=auto . $out
'';
outputHash = "sha256-r+FDV9mYhcMyysjMk91O6MIbsBkDMwvK4H1KGQ5ZrV8=";
outputHashMode = "recursive";
};
subPackages = [ "." ];
ldflags = [ "-s" "-w" ]; ## don't include version info twice
vendorHash = null;
});
}

View file

@ -0,0 +1,14 @@
{ config, pkgs, lib, ...}:
let
cfg = config.ragon.services.caddy;
in
{
options.ragon.services.caddy.enable = lib.mkEnableOption "enables the caddy webserver";
config = lib.mkIf cfg.enable {
services.caddy = {
enable = true;
package = import ./custom-caddy.nix { inherit pkgs; };
};
ragon.persist.extraDirectories = [ config.services.caddy.dataDir ];
};
}