1{ lib
2, buildGoModule
3, fetchFromGitHub
4, makeWrapper
5, nixosTests
6, openssh
7}:
8buildGoModule rec {
9 pname = "zrepl";
10 version = "0.6.1";
11
12 src = fetchFromGitHub {
13 owner = "zrepl";
14 repo = "zrepl";
15 rev = "v${version}";
16 sha256 = "sha256-sFSWcJ0aBMay+ngUqnr0PKBMOfCcKHgBjff6KRpPZrg=";
17 };
18
19 vendorHash = "sha256-75fGejR7eiECsm1j3yIU1lAWaW9GrorrVnv8JEzkAtU=";
20
21 subPackages = [ "." ];
22
23 nativeBuildInputs = [
24 makeWrapper
25 ];
26
27 ldflags = [ "-s" "-w" "-X github.com/zrepl/zrepl/version.zreplVersion=${version}" ];
28
29 postInstall = ''
30 mkdir -p $out/lib/systemd/system
31 substitute dist/systemd/zrepl.service $out/lib/systemd/system/zrepl.service \
32 --replace /usr/local/bin/zrepl $out/bin/zrepl
33
34 wrapProgram $out/bin/zrepl \
35 --prefix PATH : ${lib.makeBinPath [ openssh ]}
36 '';
37
38 passthru.tests = {
39 inherit (nixosTests) zrepl;
40 };
41
42 meta = with lib; {
43 homepage = "https://zrepl.github.io/";
44 description = "A one-stop, integrated solution for ZFS replication";
45 platforms = platforms.linux;
46 license = licenses.mit;
47 maintainers = with maintainers; [ cole-h danderson mdlayher ];
48 };
49}