12 dist = fetchFromGitHub {
13 owner = "caddyserver";
16 hash = "sha256-O4s7PhSUTXoNEIi+zYASx8AgClMC5rs7se863G6w+l0=";
23 src = fetchFromGitHub {
24 owner = "caddyserver";
27 hash = "sha256-CBfyqtWp3gYsYwaIxbfXO3AYaBiM7LutLC7uZgYXfkQ=";
30 vendorHash = "sha256-1Api8bBZJ1/oYk4ZGIiwWCSraLzK9L+hsKXkFtk6iVM=";
32 subPackages = [ "cmd/caddy" ];
36 "-X github.com/caddyserver/caddy/v2.CustomVersion=${version}"
39 # matches upstream since v2.8.0
40 tags = [ "nobadger" ];
42 nativeBuildInputs = [ installShellFiles ];
45 install -Dm644 ${dist}/init/caddy.service ${dist}/init/caddy-api.service -t $out/lib/systemd/system
47 substituteInPlace $out/lib/systemd/system/caddy.service \
48 --replace-fail "/usr/bin/caddy" "$out/bin/caddy"
49 substituteInPlace $out/lib/systemd/system/caddy-api.service \
50 --replace-fail "/usr/bin/caddy" "$out/bin/caddy"
51 '' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
52 # Generating man pages and completions fail on cross-compilation
53 # https://github.com/NixOS/nixpkgs/issues/308283
55 $out/bin/caddy manpage --directory manpages
56 installManPage manpages/*
58 installShellCompletion --cmd caddy \
59 --bash <($out/bin/caddy completion bash) \
60 --fish <($out/bin/caddy completion fish) \
61 --zsh <($out/bin/caddy completion zsh)
65 inherit (nixosTests) caddy;
66 version = testers.testVersion {
67 command = "${caddy}/bin/caddy version";
73 homepage = "https://caddyserver.com";
74 description = "Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS";
75 license = licenses.asl20;
76 mainProgram = "caddy";
77 maintainers = with maintainers; [ Br1ght0ne emilylange techknowlogick ];