Skip to content

Commit

Permalink
caddy: 2.6.0 -> 2.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
techknowlogick committed Sep 22, 2022
1 parent 3b5ee8a commit 87810a6
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 6 deletions.
40 changes: 34 additions & 6 deletions pkgs/servers/caddy/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{ lib, buildGoModule, fetchFromGitHub, nixosTests }:
{ lib
, buildGoModule
, fetchFromGitHub
, nixosTests
, caddy
, testers
, installShellFiles
}:
let
version = "2.6.0";
version = "2.6.1";
dist = fetchFromGitHub {
owner = "caddyserver";
repo = "dist";
Expand All @@ -12,25 +19,46 @@ buildGoModule {
pname = "caddy";
inherit version;

subPackages = [ "cmd/caddy" ];

src = fetchFromGitHub {
owner = "caddyserver";
repo = "caddy";
rev = "v${version}";
sha256 = "sha256-BZGfYpQM5e+/LrGqs1oms/vOp9q4UY/ZyDODEsi/wl8=";
sha256 = "sha256-Z8MiMhXH1er+uYvmDQiamF/jSxHbTMwjo61qbH0ioEo=";
};

vendorSha256 = "sha256-6UTErIPB/z4RfndPSLKFJDFweLB3ax8WxEDA+3G5asI=";

patches = [
./inject_version.diff
];

subPackages = [ "cmd/caddy" ];

ldflags = [
"-s" "-w"
"-X github.com/caddyserver/caddy/v2.ShortVersion=${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"
installShellCompletion --cmd metal \
--bash <($out/bin/caddy completion bash) \
--zsh <($out/bin/caddy completion zsh)
'';

passthru.tests = { inherit (nixosTests) caddy; };
passthru.tests = {
inherit (nixosTests) caddy;
version = testers.testVersion {
command = "${caddy}/bin/caddy version";
package = caddy;
};
};

meta = with lib; {
homepage = "https://caddyserver.com";
Expand Down
15 changes: 15 additions & 0 deletions pkgs/servers/caddy/inject_version.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/caddy.go b/caddy.go
index 584865bd..082b9b6c 100644
--- a/caddy.go
+++ b/caddy.go
@@ -840,7 +840,10 @@ func InstanceID() (uuid.UUID, error) {
// and https://github.com/golang/go/issues/50603.
//
// This function is experimental and subject to change or removal.
+var ShortVersion = "(devel)"
+
func Version() (simple, full string) {
+ return ShortVersion, ShortVersion
// the currently-recommended way to build Caddy involves
// building it as a dependency so we can extract version
// information from go.mod tooling; once the upstream

0 comments on commit 87810a6

Please sign in to comment.