gnuk: Add derivation for fst-01

This commit is contained in:
William A. Kennington III 2015-04-29 21:29:26 -07:00
parent 9dcac56f34
commit 36f6601e12
5 changed files with 89 additions and 0 deletions

View File

@ -0,0 +1,11 @@
{ callPackage, fetchgit, ... } @ args:
callPackage ./generic.nix (args // rec {
version = "1.0.4";
src = fetchgit {
url = "git://git.gniibe.org/gnuk/gnuk.git";
rev = "93867d0c8b90c485f9832c0047c3a2e17a029aca";
sha256 = "176vx81m6wnfvamxpp7hfbs1pm692zr0my0z2gid65b6rgffdycd";
};
})

View File

@ -0,0 +1,52 @@
{ stdenv, gcc-arm-embedded, makeWrapper
, python, pythonPackages
# Extra options
, device ? "fsij", vid ? "234b", pid ? "0000"
# Version specific options
, version, src
, ...
}:
stdenv.mkDerivation {
name = "gnuk-${version}-${device}";
inherit src;
nativeBuildInputs = [ gcc-arm-embedded makeWrapper ];
buildInputs = [ python ] ++ (with pythonPackages; [ pyusb colorama ]);
configurePhase = ''
cd src
patchShebangs configure
./configure --vidpid=${vid}:${pid}
'';
installPhase = ''
mkdir -p $out/bin
find . -name gnuk.bin -exec cp {} $out \;
#sed -i 's,Exception as e,IOError as e,' ../tool/stlinkv2.py
sed -i ../tool/stlinkv2.py \
-e "1a import array" \
-e "s,\(data_received =\) (),\1 array.array('B'),g" \
-e "s,\(data_received\) = data_received + \(.*\),\1.extend(\2),g"
cp ../tool/stlinkv2.py $out/bin/stlinkv2
wrapProgram $out/bin/stlinkv2 --prefix PYTHONPATH : "$PYTHONPATH"
# Some useful helpers
echo "#! ${stdenv.shell} -e" | tee $out/bin/{unlock,flash}
echo "$out/bin/stlinkv2 -u \$@" >> $out/bin/unlock
echo "$out/bin/stlinkv2 -b \$@ $out/gnuk.bin" >> $out/bin/flash
chmod +x $out/bin/{unlock,flash}
'';
meta = with stdenv.lib; {
homepage = http://www.fsij.org/pages/gnuk;
description = "an implementation of USB cryptographic token for gpg";
license = licenses.gpl3;
maintainers = with maintainers; [ wkennington ];
};
}

11
pkgs/misc/gnuk/git.nix Normal file
View File

@ -0,0 +1,11 @@
{ callPackage, fetchgit, ... } @ args:
callPackage ./generic.nix (args // rec {
version = "2015-04-22";
src = fetchgit {
url = "git://git.gniibe.org/gnuk/gnuk.git";
rev = "3d5a776ab15a4ae6e17d91341a58eda3db09f700";
sha256 = "1pkdca331wrf1lsnlxxwbbnfcr7vj9xsac92dhj06fhpq4mb8kgb";
};
})

View File

@ -0,0 +1,11 @@
{ callPackage, fetchgit, ... } @ args:
callPackage ./generic.nix (args // rec {
version = "1.1.4";
src = fetchgit {
url = "git://git.gniibe.org/gnuk/gnuk.git";
rev = "e7e8b9f5ca414a5c901f61b0f043c8da42414103";
sha256 = "0zjpgvmnvgvfqp9cd9g8ns9z05alimwcdqx16l22604ywnhdy99l";
};
})

View File

@ -13992,6 +13992,10 @@ let
x11Support = true; x11Support = true;
}); });
gnuk = callPackage ../misc/gnuk { };
gnuk-unstable = callPackage ../misc/gnuk/unstable.nix { };
gnuk-git = callPackage ../misc/gnuk/git.nix { };
guix = callPackage ../tools/package-management/guix { }; guix = callPackage ../tools/package-management/guix { };
gxemul = callPackage ../misc/emulators/gxemul { }; gxemul = callPackage ../misc/emulators/gxemul { };