anvil-editor: init at 0.4
[NixPkgs.git] / pkgs / tools / archivers / gbl / default.nix
blob6bbc31a6b1c62269f1fb737f71b65f32cb51114b
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , rustPlatform
5 , fetchpatch
6 , pkg-config
7 , openssl
8 , testers
9 , gbl
10 , Security
13 rustPlatform.buildRustPackage rec {
14   pname = "gbl";
15   version = "0.3.1";
17   src = fetchFromGitHub {
18     owner = "dac-gmbh";
19     repo = pname;
20     rev = "v${version}";
21     sha256 = "sha256-Xzx14fvYWTZYM9Pnowf1M3D0PTPRLwsXHUj/PJskRWw=";
22   };
24   cargoPatches = [
25     # update ring to fix building on Mac M1
26     # https://github.com/dac-gmbh/gbl/pull/64
27     (fetchpatch {
28       url = "https://github.com/raboof/gbl/commit/17e154d66932af59abe8677309792606b7f64c7d.patch";
29       sha256 = "sha256-5Itoi86Q+9FzSTtnggODKPwwYPp5BpIVgR2vYMLHBts=";
30     })
31     # Upstream does not include Cargo.lock, even though this is recommended for applications.
32     (fetchpatch {
33       url = "https://github.com/raboof/gbl/commit/9423d36ee3168bca8db7a7cb65611dc7ddc2daf0.patch";
34       sha256 = "sha256-zwHXgUVkAYiQs/AT/pINnZoECoXzh+9astWMYENGTL8=";
35     })
36   ];
38   cargoHash = "sha256-CeGLSseKUe2XudRqZm5Y7o7ZLDtDBg/MFunOGqxFZGM=";
40   nativeBuildInputs = [ pkg-config ];
41   buildInputs = [ openssl ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ Security ];
43   passthru.tests.version =
44     testers.testVersion { package = gbl; };
46   meta = with lib; {
47     description = "GBL Firmware file manipulation";
48     longDescription = ''
49       Utility to read, create and manipulate `.gbl` firmware update
50       files targeting the Silicon Labs Gecko Bootloader.
51     '';
52     homepage = "https://github.com/jonas-schievink/gbl";
53     license = licenses.mit;
54     maintainers = [ maintainers.raboof ];
55     mainProgram = "gbl";
56   };