normcap: 0.5.8 -> 0.5.9 (#355312)
[NixPkgs.git] / pkgs / by-name / ni / nitrokey-pro-firmware / package.nix
blob8c14178fc7440631e860ca1d7d3c5db616251be6
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   writeShellScriptBin,
6   python3,
7   srecord,
8   gcc-arm-embedded,
9 }:
11 let
12   version = "0.15";
14   # The firmware version is pulled from `git` so we stub it here to avoid pulling the whole program.
15   fakeGit = writeShellScriptBin "git" ''
16     echo "${version}.nitrokey"
17   '';
21 stdenv.mkDerivation {
22   pname = "nitrokey-pro-firmware";
23   inherit version;
24   src = fetchFromGitHub {
25     owner = "Nitrokey";
26     repo = "nitrokey-pro-firmware";
27     rev = "v${version}";
28     hash = "sha256-q+kbEOLA05xR6weAWDA1hx4fVsaN9UNKiOXGxPRfXuI=";
29     fetchSubmodules = true;
30   };
32   postPatch = ''
33     patchShebangs dapboot/libopencm3/scripts
34   '';
36   nativeBuildInputs = [
37     fakeGit
38     gcc-arm-embedded
39     python3
40     srecord
41   ];
43   installPhase = ''
44     runHook preInstall
45     install -D build/gcc/bootloader.hex $out/bootloader.hex
46     install -D build/gcc/nitrokey-pro-firmware.hex $out/firmware.hex
47     runHook postInstall
48   '';
50   meta = {
51     description = "Firmware for the Nitrokey Pro device";
52     homepage = "https://github.com/Nitrokey/nitrokey-pro-firmware";
53     license = lib.licenses.gpl3Plus;
54     maintainers = with lib.maintainers; [
55       imadnyc
56       kiike
57       amerino
58     ];
59     platforms = lib.platforms.unix;
60   };