Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
2
3buildGoModule rec {
4 pname = "dyff";
5 version = "1.5.7";
6
7 src = fetchFromGitHub {
8 owner = "homeport";
9 repo = "dyff";
10 rev = "v${version}";
11 sha256 = "sha256-iavJgJnmUFNjdCwVifNP1K5gQ94Rth4wbZ99VXFgNpA=";
12 };
13
14 vendorHash = "sha256-48IpEBA5EaGZBhrRqAwGcf8xQuP/IlzWPFhh+7bFlPc=";
15
16 subPackages = [
17 "cmd/dyff"
18 "pkg/dyff"
19 "internal/cmd"
20 ];
21
22 nativeBuildInputs = [ installShellFiles ];
23
24 # test fails with the injected version
25 postPatch = ''
26 substituteInPlace internal/cmd/cmds_test.go \
27 --replace "version (development)" ${version}
28 '';
29
30 ldflags = [
31 "-s"
32 "-w"
33 "-X=github.com/homeport/dyff/internal/cmd.version=${version}"
34 ];
35
36 postInstall = ''
37 installShellCompletion --cmd dyff \
38 --bash <($out/bin/dyff completion bash) \
39 --fish <($out/bin/dyff completion fish) \
40 --zsh <($out/bin/dyff completion zsh)
41 '';
42
43 meta = with lib; {
44 description = "A diff tool for YAML files, and sometimes JSON";
45 longDescription = ''
46 dyff is inspired by the way the old BOSH v1 deployment output reported
47 changes from one version to another by only showing the parts of a YAML
48 file that change.
49
50 Each difference is referenced by its location in the YAML document by
51 using either the Spruce or go-patch path syntax.
52 '';
53 homepage = "https://github.com/homeport/dyff";
54 license = licenses.mit;
55 maintainers = with maintainers; [ edlimerkaj jceb ];
56 };
57}