nixpkgs/pkgs/servers/caddy/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

70 lines
1.8 KiB
Nix
Raw Normal View History

2022-09-22 02:12:25 +00:00
{ 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;
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";
repo = "caddy";
2016-09-21 16:52:17 +00:00
rev = "v${version}";
hash = "sha256-oZSAY7vS8ersnj3vUtxj/qKlLvNvNL2RQHrNr4Cc60k=";
2016-06-05 08:43:36 +00:00
};
vendorHash = "sha256-CnWAVGPrHIjWJgh4LwJvrjQJp/Pz92QHdANXZIcIhg8=";
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 ];
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)
'';
2022-09-22 02:12:25 +00:00
passthru.tests = {
inherit (nixosTests) caddy;
version = testers.testVersion {
command = "${caddy}/bin/caddy version";
package = caddy;
};
};
meta = with lib; {
2019-12-02 14:18:23 +00:00
homepage = "https://caddyserver.com";
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;
maintainers = with maintainers; [ Br1ght0ne emilylange techknowlogick ];
2016-09-21 16:52:17 +00:00
};
}