15 stdenv.mkDerivation (finalAttrs: {
19 src = fetchFromGitLab {
20 domain = "salsa.debian.org";
23 rev = "release/${finalAttrs.version}";
24 hash = "sha256-qY/dwkcPJiPx/+inSxH7w7a0v3cWUQDX+NYJwUjnkMY=";
25 fetchSubmodules = true;
34 buildInputs = with python3Packages; [
40 sourceRoot = "${finalAttrs.src.name}/src";
42 configureFlags = [ "--vidpid=${vid}:${pid}" ];
44 # TODO: Check how many of these patches are actually needed.
48 find . -name gnuk.bin -exec cp {} $out \;
50 #sed -i 's,Exception as e,IOError as e,' ../tool/stlinkv2.py
51 sed -i ../tool/stlinkv2.py \
52 -e "1a import array" \
53 -e "s,\(data_received =\) (),\1 array.array('B'),g" \
54 -e "s,\(data_received\) = data_received + \(.*\),\1.extend(\2),g"
55 cp ../tool/stlinkv2.py $out/bin/stlinkv2
56 wrapProgram $out/bin/stlinkv2 --prefix PYTHONPATH : "$PYTHONPATH"
59 echo "#! ${stdenv.shell} -e" | tee $out/bin/{unlock,flash}
60 echo "$out/bin/stlinkv2 -u \$@" >> $out/bin/unlock
61 echo "$out/bin/stlinkv2 -b \$@ $out/gnuk.bin" >> $out/bin/flash
62 chmod +x $out/bin/{unlock,flash}
66 homepage = "https://www.fsij.org/category/gnuk.html";
67 description = "Implementation of USB cryptographic token for gpg";
68 license = lib.licenses.gpl3;
69 platforms = lib.platforms.linux;
71 broken = true; # Needs Picolib, which is not packaged in Nixpkgs.