nixpkgs/pkgs/by-name/ni/nitrokey-pro-firmware/package.nix
Enric Morales f5d40dac12 nitrokey-pro-firmware: init at 0.15
Co-authored-by: Simon Bruder <simon@sbruder.de>
Co-authored-by: Abdullah Imad <me@imad.nyc>
Co-authored-by: Alberto Merino <amerinor01@gmail.com>
Co-authored-by: Enric Morales <me@enric.me>
Co-authored-by: Jack Leightcap <jack@leightcap.com>
Co-authored-by: Roland Coeurjoly <rolandcoeurjoly@gmail.com>
2024-09-10 12:10:55 +02:00

62 lines
1.2 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
writeShellScriptBin,
python3,
srecord,
gcc-arm-embedded,
}:
let
version = "0.15";
# The firmware version is pulled from `git` so we stub it here to avoid pulling the whole program.
fakeGit = writeShellScriptBin "git" ''
echo "${version}.nitrokey"
'';
in
stdenv.mkDerivation {
pname = "nitrokey-pro-firmware";
inherit version;
src = fetchFromGitHub {
owner = "Nitrokey";
repo = "nitrokey-pro-firmware";
rev = "v${version}";
hash = "sha256-q+kbEOLA05xR6weAWDA1hx4fVsaN9UNKiOXGxPRfXuI=";
fetchSubmodules = true;
};
postPatch = ''
patchShebangs dapboot/libopencm3/scripts
'';
nativeBuildInputs = [
fakeGit
gcc-arm-embedded
python3
srecord
];
installPhase = ''
runHook preInstall
install -D build/gcc/bootloader.hex $out/bootloader.hex
install -D build/gcc/nitrokey-pro-firmware.hex $out/firmware.hex
runHook postInstall
'';
meta = {
description = "Firmware for the Nitrokey Pro device";
homepage = "https://github.com/Nitrokey/nitrokey-pro-firmware";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [
imadnyc
kiike
amerino
];
platforms = lib.platforms.unix;
};
}