2022-09-22 03:12:25 +01:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, nixosTests
|
|
|
|
, caddy
|
|
|
|
, testers
|
|
|
|
, installShellFiles
|
|
|
|
}:
|
2021-11-29 14:16:25 +00:00
|
|
|
let
|
2022-10-13 20:14:42 +01:00
|
|
|
version = "2.6.2";
|
2021-11-29 14:16:25 +00:00
|
|
|
dist = fetchFromGitHub {
|
|
|
|
owner = "caddyserver";
|
|
|
|
repo = "dist";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "sha256-EXs+LNb87RWkmSWvs8nZIVqRJMutn+ntR241gqI7CUg=";
|
|
|
|
};
|
|
|
|
in
|
|
|
|
buildGoModule {
|
|
|
|
pname = "caddy";
|
|
|
|
inherit version;
|
2016-06-05 09:43:36 +01:00
|
|
|
|
2016-08-21 16:08:33 +01:00
|
|
|
src = fetchFromGitHub {
|
2019-09-23 04:22:22 +01:00
|
|
|
owner = "caddyserver";
|
2021-11-29 14:16:25 +00:00
|
|
|
repo = "caddy";
|
2016-09-21 17:52:17 +01:00
|
|
|
rev = "v${version}";
|
2022-10-13 20:14:42 +01:00
|
|
|
sha256 = "sha256-Tbf6RB3106OEZGc/Wx7vk+I82Z8/Q3WqnID4f8uZ6z0=";
|
2016-06-05 09:43:36 +01:00
|
|
|
};
|
|
|
|
|
2022-10-13 20:14:42 +01:00
|
|
|
vendorSha256 = "sha256-YxGXk3Q1qw6uZxrGc8l2lKExP2GP+nm3eYbHDoEbgdY=";
|
2022-09-22 03:12:25 +01:00
|
|
|
|
|
|
|
subPackages = [ "cmd/caddy" ];
|
|
|
|
|
|
|
|
ldflags = [
|
|
|
|
"-s" "-w"
|
2022-10-13 20:14:42 +01:00
|
|
|
"-X github.com/caddyserver/caddy/v2.CustomVersion=${version}"
|
2022-09-22 03:12:25 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
2021-11-29 14:16:25 +00:00
|
|
|
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"
|
2022-09-22 03:12:25 +01:00
|
|
|
|
|
|
|
installShellCompletion --cmd metal \
|
|
|
|
--bash <($out/bin/caddy completion bash) \
|
|
|
|
--zsh <($out/bin/caddy completion zsh)
|
2021-11-29 14:16:25 +00:00
|
|
|
'';
|
|
|
|
|
2022-09-22 03:12:25 +01:00
|
|
|
passthru.tests = {
|
|
|
|
inherit (nixosTests) caddy;
|
|
|
|
version = testers.testVersion {
|
|
|
|
command = "${caddy}/bin/caddy version";
|
|
|
|
package = caddy;
|
|
|
|
};
|
|
|
|
};
|
2016-08-14 18:55:52 +01:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-12-02 14:18:23 +00:00
|
|
|
homepage = "https://caddyserver.com";
|
2016-09-21 17:52:17 +01:00
|
|
|
description = "Fast, cross-platform HTTP/2 web server with automatic HTTPS";
|
|
|
|
license = licenses.asl20;
|
2022-04-25 18:42:40 +01:00
|
|
|
maintainers = with maintainers; [ Br1ght0ne techknowlogick ];
|
2016-09-21 17:52:17 +01:00
|
|
|
};
|
2020-07-31 04:58:04 +01:00
|
|
|
}
|