diff options
author | William A. Kennington III <william@wkennington.com> | 2015-04-29 21:29:26 -0700 |
---|---|---|
committer | William A. Kennington III <william@wkennington.com> | 2015-05-02 15:54:42 -0700 |
commit | 36f6601e121c7565fe7c0004cb9ff3307bae5f11 (patch) | |
tree | 03f113381e1f471925208e008eb0b2023311149b /pkgs/misc/gnuk | |
parent | 9dcac56f34f905a656db546ff06d9cdd5bbb41d5 (diff) |
gnuk: Add derivation for fst-01
Diffstat (limited to 'pkgs/misc/gnuk')
-rw-r--r-- | pkgs/misc/gnuk/default.nix | 11 | ||||
-rw-r--r-- | pkgs/misc/gnuk/generic.nix | 52 | ||||
-rw-r--r-- | pkgs/misc/gnuk/git.nix | 11 | ||||
-rw-r--r-- | pkgs/misc/gnuk/unstable.nix | 11 |
4 files changed, 85 insertions, 0 deletions
diff --git a/pkgs/misc/gnuk/default.nix b/pkgs/misc/gnuk/default.nix new file mode 100644 index 0000000000000..fb845d9c47658 --- /dev/null +++ b/pkgs/misc/gnuk/default.nix @@ -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"; + }; +}) diff --git a/pkgs/misc/gnuk/generic.nix b/pkgs/misc/gnuk/generic.nix new file mode 100644 index 0000000000000..52e970b5b8222 --- /dev/null +++ b/pkgs/misc/gnuk/generic.nix @@ -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 ]; + }; +} diff --git a/pkgs/misc/gnuk/git.nix b/pkgs/misc/gnuk/git.nix new file mode 100644 index 0000000000000..8c03a1eee5361 --- /dev/null +++ b/pkgs/misc/gnuk/git.nix @@ -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"; + }; +}) diff --git a/pkgs/misc/gnuk/unstable.nix b/pkgs/misc/gnuk/unstable.nix new file mode 100644 index 0000000000000..0bfcbc023bf11 --- /dev/null +++ b/pkgs/misc/gnuk/unstable.nix @@ -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"; + }; +}) |