3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #192351 from techknowlogick/caddy-261

caddy: 2.6.0 -> 2.6.1
This commit is contained in:
superherointj 2022-09-22 17:17:42 -03:00 committed by GitHub
commit 74ecdc112c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 49 additions and 6 deletions

View file

@ -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";
@ -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";

View file

@ -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