5557ff764c
GitOrigin-RevId: 988cc958c57ce4350ec248d2d53087777f9e1949
69 lines
1.8 KiB
Nix
69 lines
1.8 KiB
Nix
{ 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 = fetchFromGitHub {
|
|
owner = "caddyserver";
|
|
repo = "caddy";
|
|
rev = "v${version}";
|
|
hash = "sha256-3a3+nFHmGONvL/TyQRqgJtrSDIn0zdGy9YwhZP17mU0=";
|
|
};
|
|
|
|
vendorHash = "sha256-toi6efYZobjDV3YPT9seE/WZAzNaxgb1ioVG4txcuXM=";
|
|
|
|
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 metal \
|
|
--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 indeednotjames techknowlogick ];
|
|
};
|
|
}
|