about summary refs log tree commit diff
path: root/pkgs/tools/archivers/gbl/default.nix
blob: 90c66e8ac7c53e622ee1f3d2e6a67556b4f6fa6a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{ lib
, stdenv
, fetchFromGitHub
, rustPlatform
, fetchpatch
, pkg-config
, openssl
, testers
, gbl
, Security
}:

rustPlatform.buildRustPackage rec {
  pname = "gbl";
  version = "0.3.1";

  src = fetchFromGitHub {
    owner = "dac-gmbh";
    repo = pname;
    rev = "v${version}";
    sha256 = "sha256-Xzx14fvYWTZYM9Pnowf1M3D0PTPRLwsXHUj/PJskRWw=";
  };

  cargoPatches = [
    # update ring to fix building on Mac M1
    # https://github.com/dac-gmbh/gbl/pull/64
    (fetchpatch {
      url = "https://github.com/raboof/gbl/commit/17e154d66932af59abe8677309792606b7f64c7d.patch";
      sha256 = "sha256-5Itoi86Q+9FzSTtnggODKPwwYPp5BpIVgR2vYMLHBts=";
    })
    # Upstream does not include Cargo.lock, even though this is recommended for applications.
    (fetchpatch {
      url = "https://github.com/raboof/gbl/commit/9423d36ee3168bca8db7a7cb65611dc7ddc2daf0.patch";
      sha256 = "sha256-zwHXgUVkAYiQs/AT/pINnZoECoXzh+9astWMYENGTL8=";
    })
  ];

  cargoSha256 = "sha256-CeGLSseKUe2XudRqZm5Y7o7ZLDtDBg/MFunOGqxFZGM=";

  nativeBuildInputs = [ pkg-config ];
  buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ Security ];

  passthru.tests.version =
    testers.testVersion { package = gbl; };

  meta = with lib; {
    description = "GBL Firmware file manipulation";
    longDescription = ''
      Utility to read, create and manipulate `.gbl` firmware update
      files targeting the Silicon Labs Gecko Bootloader.
    '';
    homepage = "https://github.com/jonas-schievink/gbl";
    license = licenses.mit;
    maintainers = [ maintainers.raboof ];
  };
}