1{ lib
2, stdenv
3, buildGoModule
4, fetchFromGitHub
5, fetchpatch
6, pkg-config
7, btrfs-progs
8, gpgme
9, lvm2
10}:
11
12buildGoModule rec {
13 pname = "dive";
14 version = "0.11.0";
15
16 src = fetchFromGitHub {
17 owner = "wagoodman";
18 repo = "dive";
19 rev = "v${version}";
20 hash = "sha256-9REthyb+bzsb7NBXkU9XyUZJFQHHrV1cG4//lTLgTgw=";
21 };
22
23 patches = [
24 # fixes: unsafe.Slice requires go1.17 or later (-lang was set to go1.16; check go.mod)
25 # https://github.com/wagoodman/dive/pull/461
26 (fetchpatch {
27 url = "https://github.com/wagoodman/dive/commit/555555d777f961ad0a2d1bb843e87f434d731dba.patch";
28 hash = "sha256-tPSgvENiVgrlQSkT7LbQPRYhkkaYQeWRJ0P4bA3XOiI=";
29 })
30 ];
31
32 vendorHash = "sha256-6KIbTrkvdugsUKdFBqtPUFzs/6h2xslLFpr6S2nSBiY=";
33
34 nativeBuildInputs = [ pkg-config ];
35
36 buildInputs = lib.optionals stdenv.isLinux [ btrfs-progs gpgme lvm2 ];
37
38 ldflags = [ "-s" "-w" "-X main.version=${version}" ];
39
40 meta = with lib; {
41 description = "A tool for exploring each layer in a docker image";
42 homepage = "https://github.com/wagoodman/dive";
43 license = licenses.mit;
44 maintainers = with maintainers; [ marsam SuperSandro2000 ];
45 };
46}