Skip to content

Commit fe81678

Browse files
authored
gnuk: refactor, mark broken (#353217)
2 parents f8619f3 + ec8cc3e commit fe81678

File tree

2 files changed

+69
-59
lines changed

2 files changed

+69
-59
lines changed

pkgs/misc/gnuk/default.nix

Lines changed: 69 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,73 @@
1-
{ callPackage, fetchgit, ... } @ args:
1+
{
2+
lib,
3+
stdenv,
4+
fetchFromGitLab,
5+
gcc-arm-embedded,
6+
binutils-arm-embedded,
7+
makeWrapper,
8+
python3Packages,
29

3-
callPackage ./generic.nix (args // {
4-
version = "1.2.14";
10+
# Default FSIJ IDs
11+
vid ? "234b",
12+
pid ? "0000",
13+
}:
514

6-
src = fetchgit {
7-
url = "git://git.gniibe.org/gnuk/gnuk.git";
8-
rev = "177ef67edfa2306c2a369a037362385c354083e1";
9-
sha256 = "16wa3xsaq4r8caw6c24hnv4j78bklacix4in2y66j35h68ggr3j1";
15+
stdenv.mkDerivation (finalAttrs: {
16+
pname = "gnuk";
17+
version = "2.2";
18+
19+
src = fetchFromGitLab {
20+
domain = "salsa.debian.org";
21+
owner = "gnuk-team";
22+
repo = "gnuk/gnuk";
23+
rev = "release/${finalAttrs.version}";
24+
hash = "sha256-qY/dwkcPJiPx/+inSxH7w7a0v3cWUQDX+NYJwUjnkMY=";
25+
fetchSubmodules = true;
26+
};
27+
28+
nativeBuildInputs = [
29+
gcc-arm-embedded
30+
binutils-arm-embedded
31+
makeWrapper
32+
];
33+
34+
buildInputs = with python3Packages; [
35+
python
36+
pyusb
37+
colorama
38+
];
39+
40+
sourceRoot = "${finalAttrs.src.name}/src";
41+
42+
configureFlags = [ "--vidpid=${vid}:${pid}" ];
43+
44+
# TODO: Check how many of these patches are actually needed.
45+
installPhase = ''
46+
mkdir -p $out/bin
47+
48+
find . -name gnuk.bin -exec cp {} $out \;
49+
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"
57+
58+
# Some useful helpers
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}
63+
'';
64+
65+
meta = {
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;
70+
maintainers = [ ];
71+
broken = true; # Needs Picolib, which is not packaged in Nixpkgs.
1072
};
1173
})

pkgs/misc/gnuk/generic.nix

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)