Skip to content

Commit ef23d0d

Browse files
committed
feature: wal-g v 3 and v 2
1 parent 01978ef commit ef23d0d

File tree

1 file changed

+63
-45
lines changed

1 file changed

+63
-45
lines changed

nix/wal-g.nix

Lines changed: 63 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,52 +7,70 @@
77
installShellFiles,
88
}:
99

10-
buildGoModule rec {
11-
pname = "wal-g";
12-
version = "3.0.5";
13-
14-
src = fetchFromGitHub {
15-
owner = "wal-g";
16-
repo = "wal-g";
17-
rev = "v${version}";
18-
sha256 = "sha256-wVr0L2ZXMuEo6tc2ajNzPinVQ8ZVzNOSoaHZ4oFsA+U=";
10+
let
11+
walGCommon = { version, vendorHash, sha256 }:
12+
buildGoModule rec {
13+
pname = "wal-g";
14+
inherit version;
15+
16+
src = fetchFromGitHub {
17+
owner = "wal-g";
18+
repo = "wal-g";
19+
rev = "v${version}";
20+
inherit sha256;
21+
};
22+
23+
inherit vendorHash;
24+
25+
nativeBuildInputs = [ installShellFiles ];
26+
27+
buildInputs = [
28+
brotli
29+
libsodium
30+
];
31+
32+
subPackages = [ "main/pg" ];
33+
34+
tags = [
35+
"brotli"
36+
"libsodium"
37+
];
38+
39+
ldflags = [
40+
"-s"
41+
"-w"
42+
"-X github.com/wal-g/wal-g/cmd/pg.walgVersion=${version}"
43+
"-X github.com/wal-g/wal-g/cmd/pg.gitRevision=${src.rev}"
44+
];
45+
46+
postInstall = ''
47+
mv $out/bin/pg $out/bin/wal-g
48+
installShellCompletion --cmd wal-g \
49+
--bash <($out/bin/wal-g completion bash) \
50+
--zsh <($out/bin/wal-g completion zsh)
51+
'';
52+
53+
meta = with lib; {
54+
homepage = "https://github.com/wal-g/wal-g";
55+
license = licenses.asl20;
56+
description = "Archival restoration tool for PostgreSQL";
57+
mainProgram = "wal-g";
58+
maintainers = [ samrose ];
59+
};
60+
};
61+
in
62+
{
63+
# wal-g v2.0.1
64+
wal-g = walGCommon {
65+
version = "2.0.1";
66+
sha256 = "sha256-5mwA55aAHwEFabGZ6c3pi8NLcYofvoe4bb/cFj7NWok="; # Replace with actual sha256 for v2.0.1
67+
vendorHash = "sha256-BbQuY6r30AkxlCZjY8JizaOrqEBdv7rIQet9KQwYB/g="; # Replace with actual vendorHash for v2.0.1
1968
};
2069

21-
vendorHash = "sha256-YDLAmRfDl9TgbabXj/1rxVQ052NZDg3IagXVTe5i9dw=";
22-
23-
nativeBuildInputs = [ installShellFiles ];
24-
25-
buildInputs = [
26-
brotli
27-
libsodium
28-
];
29-
30-
subPackages = [ "main/pg" ];
31-
32-
tags = [
33-
"brotli"
34-
"libsodium"
35-
];
36-
37-
ldflags = [
38-
"-s"
39-
"-w"
40-
"-X github.com/wal-g/wal-g/cmd/pg.walgVersion=${version}"
41-
"-X github.com/wal-g/wal-g/cmd/pg.gitRevision=${src.rev}"
42-
];
43-
44-
postInstall = ''
45-
mv $out/bin/pg $out/bin/wal-g
46-
installShellCompletion --cmd wal-g \
47-
--bash <($out/bin/wal-g completion bash) \
48-
--zsh <($out/bin/wal-g completion zsh)
49-
'';
50-
51-
meta = with lib; {
52-
homepage = "https://github.com/wal-g/wal-g";
53-
license = licenses.asl20;
54-
description = "Archival restoration tool for PostgreSQL";
55-
mainProgram = "wal-g";
56-
maintainers = [ samrose ];
70+
# wal-g v3.0.5
71+
wal-g-3 = walGCommon {
72+
version = "3.0.5";
73+
sha256 = "sha256-wVr0L2ZXMuEo6tc2ajNzPinVQ8ZVzNOSoaHZ4oFsA+U=";
74+
vendorHash = "sha256-YDLAmRfDl9TgbabXj/1rxVQ052NZDg3IagXVTe5i9dw=";
5775
};
5876
}

0 commit comments

Comments
 (0)