mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-25 23:23:07 +00:00
bccff6f3ef
https://github.com/caddyserver/caddy/releases/tag/v2.7.4 diff: https://github.com/caddyserver/caddy/compare/v2.7.3...v2.7.4
70 lines
1.8 KiB
Nix
70 lines
1.8 KiB
Nix
{ lib
|
|
, buildGoModule
|
|
, fetchFromGitHub
|
|
, nixosTests
|
|
, caddy
|
|
, testers
|
|
, installShellFiles
|
|
}:
|
|
let
|
|
version = "2.7.4";
|
|
dist = fetchFromGitHub {
|
|
owner = "caddyserver";
|
|
repo = "dist";
|
|
rev = "v${version}";
|
|
hash = "sha256-8wdSRAONIPYe6kC948xgAGHm9cePbXsOBp9gzeDI0AI=";
|
|
};
|
|
in
|
|
buildGoModule {
|
|
pname = "caddy";
|
|
inherit version;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "caddyserver";
|
|
repo = "caddy";
|
|
rev = "v${version}";
|
|
hash = "sha256-oZSAY7vS8ersnj3vUtxj/qKlLvNvNL2RQHrNr4Cc60k=";
|
|
};
|
|
|
|
vendorHash = "sha256-CnWAVGPrHIjWJgh4LwJvrjQJp/Pz92QHdANXZIcIhg8=";
|
|
|
|
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 ];
|
|
};
|
|
}
|