summaryrefslogtreecommitdiff
path: root/pkgs/by-name/ni/nitrokey-start-firmware/package.nix
blob: 4169ccf702c0fd04debd455dab6be459411c5d47 (about) (plain)
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
57
58
59
{
  lib,
  stdenv,
  fetchFromGitHub,
  gcc-arm-embedded-13,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "nitrokey-start-firmware";
  version = "13";

  src = fetchFromGitHub {
    owner = "Nitrokey";
    repo = "nitrokey-start-firmware";
    rev = "RTM.${finalAttrs.version}";
    hash = "sha256-POW1d/fgOyYa7127FSTCtHGyMWYzKW0qqA1WUyvNc3w=";
    fetchSubmodules = true;
  };

  sourceRoot = "${finalAttrs.src.name}/src";

  postPatch = ''
    patchShebangs configure
  '';

  # Avoid additional arguments are added to configureFlags
  configurePlatforms = [ ];

  # from release/Makefile
  configureFlags = [
    "--target=NITROKEY_START-g"
    "--vidpid=20a0:4211"
    "--enable-factory-reset"
    "--enable-certdo"
  ];

  nativeBuildInputs = [ gcc-arm-embedded-13 ];

  enableParallelBuilding = true;

  installPhase = ''
    runHook preInstall
    mkdir $out
    cp build/gnuk.{bin,hex} $out/
    runHook postInstall
  '';

  meta = {
    description = "Firmware for the Nitrokey Start device";
    homepage = "https://github.com/Nitrokey/nitrokey-start-firmware";
    license = lib.licenses.gpl3Plus;
    maintainers = with lib.maintainers; [
      amerino
      imadnyc
      kiike
    ];
    platforms = lib.platforms.unix;
  };
})