summaryrefslogtreecommitdiff
path: root/caddy-cgi.nix
diff options
context:
space:
mode:
authortom barrett <thomas.barrett@de.kaercher.com>2023-09-02 13:15:36 +0200
committerTom Barrett <tom@tombarrett.xyz>2023-11-01 17:33:26 +0100
commit73e78ab226f21e6c6c68961af88c4ab9c746f4f4 (patch)
tree5b12e5d6d84a424436480d6eb2ac3e31daa57658 /caddy-cgi.nix
parent0db29e2ce9799f652f3d16fd5aed6e426d23bd0a (diff)
caddy-cgi
Diffstat (limited to 'caddy-cgi.nix')
-rw-r--r--caddy-cgi.nix65
1 files changed, 65 insertions, 0 deletions
diff --git a/caddy-cgi.nix b/caddy-cgi.nix
new file mode 100644
index 0000000..e8805e2
--- /dev/null
+++ b/caddy-cgi.nix
@@ -0,0 +1,65 @@
+{
+ lib,
+ buildGoModule,
+ fetchFromGitHub,
+ nixosTests,
+ caddy,
+ testers,
+ installShellFiles,
+}: let
+ version = "2.6.4";
+ dist = fetchFromGitHub {
+ owner = "caddyserver";
+ repo = "dist";
+ rev = "v${version}";
+ hash = "sha256-SJO1q4g9uyyky9ZYSiqXJgNIvyxT5RjrpYd20YDx8ec=";
+ };
+in
+ buildGoModule {
+ pname = "caddy";
+ inherit version;
+
+ src = ./.;
+
+ vendorHash = "sha256-SJI0GImRqpe7ksFc3XuhHQvVyuB6JqbQDAClUtaEoTI=";
+
+ subPackages = ["cmd/caddy"];
+
+ ldflags = [
+ "-s"
+ "-w"
+ "-X github.com/caddyserver/caddy/v2.CustomVersion=${version}"
+ ];
+
+ nativeBuildInputs = [installShellFiles];
+
+ 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;
+ maintainers = with maintainers; [Br1ght0ne emilylange techknowlogick];
+ };
+ }