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