2022-09-22 02:12:25 +00:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, nixosTests
|
|
|
|
, caddy
|
|
|
|
, testers
|
|
|
|
, installShellFiles
|
|
|
|
}:
|
2021-11-29 14:16:25 +00:00
|
|
|
let
|
2023-02-14 22:34:27 +00:00
|
|
|
version = "2.6.4";
|
2021-11-29 14:16:25 +00:00
|
|
|
dist = fetchFromGitHub {
|
|
|
|
owner = "caddyserver";
|
|
|
|
repo = "dist";
|
|
|
|
rev = "v${version}";
|
2023-02-14 22:34:27 +00:00
|
|
|
hash = "sha256-SJO1q4g9uyyky9ZYSiqXJgNIvyxT5RjrpYd20YDx8ec=";
|
2021-11-29 14:16:25 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
buildGoModule {
|
|
|
|
pname = "caddy";
|
|
|
|
inherit version;
|
2016-06-05 08:43:36 +00:00
|
|
|
|
2016-08-21 15:08:33 +00:00
|
|
|
src = fetchFromGitHub {
|
2019-09-23 03:22:22 +00:00
|
|
|
owner = "caddyserver";
|
2021-11-29 14:16:25 +00:00
|
|
|
repo = "caddy";
|
2016-09-21 16:52:17 +00:00
|
|
|
rev = "v${version}";
|
2023-02-14 22:34:27 +00:00
|
|
|
hash = "sha256-3a3+nFHmGONvL/TyQRqgJtrSDIn0zdGy9YwhZP17mU0=";
|
2016-06-05 08:43:36 +00:00
|
|
|
};
|
|
|
|
|
2023-02-14 22:34:27 +00:00
|
|
|
vendorHash = "sha256-toi6efYZobjDV3YPT9seE/WZAzNaxgb1ioVG4txcuXM=";
|
2022-09-22 02:12:25 +00:00
|
|
|
|
|
|
|
subPackages = [ "cmd/caddy" ];
|
|
|
|
|
|
|
|
ldflags = [
|
|
|
|
"-s" "-w"
|
2022-10-13 19:14:42 +00:00
|
|
|
"-X github.com/caddyserver/caddy/v2.CustomVersion=${version}"
|
2022-09-22 02:12:25 +00: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 02:12:25 +00:00
|
|
|
|
2023-02-19 16:44:35 +00:00
|
|
|
$out/bin/caddy manpage --directory manpages
|
|
|
|
installManPage manpages/*
|
|
|
|
|
2023-06-16 15:15:24 +00:00
|
|
|
installShellCompletion --cmd caddy \
|
2022-09-22 02:12:25 +00:00
|
|
|
--bash <($out/bin/caddy completion bash) \
|
2023-02-19 16:44:35 +00:00
|
|
|
--fish <($out/bin/caddy completion fish) \
|
2022-09-22 02:12:25 +00:00
|
|
|
--zsh <($out/bin/caddy completion zsh)
|
2021-11-29 14:16:25 +00:00
|
|
|
'';
|
|
|
|
|
2022-09-22 02:12:25 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit (nixosTests) caddy;
|
|
|
|
version = testers.testVersion {
|
|
|
|
command = "${caddy}/bin/caddy version";
|
|
|
|
package = caddy;
|
|
|
|
};
|
|
|
|
};
|
2016-08-14 17:55:52 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-12-02 14:18:23 +00:00
|
|
|
homepage = "https://caddyserver.com";
|
2023-02-09 02:31:08 +00:00
|
|
|
description = "Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS";
|
2016-09-21 16:52:17 +00:00
|
|
|
license = licenses.asl20;
|
2023-05-21 14:00:44 +00:00
|
|
|
maintainers = with maintainers; [ Br1ght0ne emilylange techknowlogick ];
|
2016-09-21 16:52:17 +00:00
|
|
|
};
|
2020-07-31 03:58:04 +00:00
|
|
|
}
|