mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-15 06:14:57 +01:00
ba913eda2d
Starting with v2.8.0, Caddy recommends building with the `nobadger` build tag. The build tag makes go skip the compilation of the badger-db implementation from smallstep/nosql, as it isn't used by Caddy and thus slightly shrinks the resulting binary size. https://github.com/caddyserver/caddy/releases/tag/v2.8.4 https://github.com/caddyserver/caddy/releases/tag/v2.8.3 https://github.com/caddyserver/caddy/releases/tag/v2.8.2 https://github.com/caddyserver/caddy/releases/tag/v2.8.1 https://github.com/caddyserver/caddy/releases/tag/v2.8.0 diff: https://github.com/caddyserver/caddy/compare/v2.7.6...v2.8.4
79 lines
2.1 KiB
Nix
79 lines
2.1 KiB
Nix
{ lib
|
|
, buildGoModule
|
|
, fetchFromGitHub
|
|
, nixosTests
|
|
, caddy
|
|
, testers
|
|
, installShellFiles
|
|
, stdenv
|
|
}:
|
|
let
|
|
version = "2.8.4";
|
|
dist = fetchFromGitHub {
|
|
owner = "caddyserver";
|
|
repo = "dist";
|
|
rev = "v${version}";
|
|
hash = "sha256-O4s7PhSUTXoNEIi+zYASx8AgClMC5rs7se863G6w+l0=";
|
|
};
|
|
in
|
|
buildGoModule {
|
|
pname = "caddy";
|
|
inherit version;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "caddyserver";
|
|
repo = "caddy";
|
|
rev = "v${version}";
|
|
hash = "sha256-CBfyqtWp3gYsYwaIxbfXO3AYaBiM7LutLC7uZgYXfkQ=";
|
|
};
|
|
|
|
vendorHash = "sha256-1Api8bBZJ1/oYk4ZGIiwWCSraLzK9L+hsKXkFtk6iVM=";
|
|
|
|
subPackages = [ "cmd/caddy" ];
|
|
|
|
ldflags = [
|
|
"-s" "-w"
|
|
"-X github.com/caddyserver/caddy/v2.CustomVersion=${version}"
|
|
];
|
|
|
|
# matches upstream since v2.8.0
|
|
tags = [ "nobadger" ];
|
|
|
|
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-fail "/usr/bin/caddy" "$out/bin/caddy"
|
|
substituteInPlace $out/lib/systemd/system/caddy-api.service \
|
|
--replace-fail "/usr/bin/caddy" "$out/bin/caddy"
|
|
'' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
|
# Generating man pages and completions fail on cross-compilation
|
|
# https://github.com/NixOS/nixpkgs/issues/308283
|
|
|
|
$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;
|
|
mainProgram = "caddy";
|
|
maintainers = with maintainers; [ Br1ght0ne emilylange techknowlogick ];
|
|
};
|
|
}
|