Created
March 3, 2024 22:29
-
-
Save Denperidge/ad3fc770a06d785e6786053cae1be6f1 to your computer and use it in GitHub Desktop.
Another attempt at Caddy with plugins!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ lib | |
, stdenv | |
, fetchFromGitHub | |
, nixosTests | |
, caddy | |
, testers | |
, installShellFiles | |
, autoPatchelfHook | |
}: | |
let | |
version = "2.7.6"; | |
dist = fetchFromGitHub { | |
owner = "caddyserver"; | |
repo = "dist"; | |
rev = "v${version}"; | |
hash = "sha256-aZ7hdAZJH1PvrX9GQLzLquzzZG3LZSKOvt7sWQhTiR8="; | |
}; | |
in | |
buildGoModule { | |
pname = "caddy"; | |
inherit version; | |
src = fetchurl { | |
url = "https://caddyserver.com/api/download?os=linux&arch=arm64&p=github.com%2Fcaddy-dns%2Fporkbun"; | |
}; | |
#vendorHash = "sha256-ebnSehuhbCY58ctM8IRVMfNxxbJBp6ht9cbuLdGFNek="; | |
subPackages = [ "cmd/caddy" ]; | |
nativeBuildInputs = [ installShellFiles, autoPatchelfHook ]; | |
installPhase = '' | |
runHook preInstall | |
install -m755 -D ${src}/caddy_linux_arm64_custom $out/bin/caddy | |
runHook postInstall | |
''; | |
postInstall = '' | |
install -Dm644 ${dist}/init/caddy.service ${dist}/init/caddy-api.service -t $out/lib/systemd/system | |
substituteInPlace $out/lib/systemd/system/caddy.service --replace "/usr/bin/caddy" "$out/bin/caddy" | |
substituteInPlace $out/lib/systemd/system/caddy-api.service --replace "/usr/bin/caddy" "$out/bin/caddy" | |
$out/bin/caddy manpage --directory manpages | |
installManPage manpages/* | |
installShellCompletion --cmd caddy \ | |
--bash <($out/bin/caddy completion bash) \ | |
--fish <($out/bin/caddy completion fish) \ | |
--zsh <($out/bin/caddy completion zsh) | |
''; | |
passthru.tests = { | |
inherit (nixosTests) caddy; | |
version = testers.testVersion { | |
command = "${caddy}/bin/caddy version"; | |
package = caddy; | |
}; | |
}; | |
meta = with lib; { | |
homepage = "https://caddyserver.com"; | |
description = "Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS"; | |
license = licenses.asl20; | |
mainProgram = "caddy"; | |
maintainers = with maintainers; [ Br1ght0ne emilylange techknowlogick ]; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment