···1+{ stdenv, fetchFromGitHub, pythonPackages
2+, pkgconfig, autoreconfHook, rsync
3+, swig, qt4, fcgi
4+, bitcoin, procps, utillinux
5+}:
6+let
7+8+ version = "0.96.1";
9+ sitePackages = pythonPackages.python.sitePackages;
10+ inherit (pythonPackages) mkPythonDerivation pyqt4 psutil twisted;
11+12+in mkPythonDerivation {
13+14+ name = "bitcoinarmory-${version}";
15+16+ src = fetchFromGitHub {
17+ owner = "goatpig";
18+ repo = "BitcoinArmory";
19+ rev = "v${version}";
20+ #sha256 = "023c7q1glhrkn4djz3pf28ckd1na52lsagv4iyfgchqvw7qm7yx2";
21+ sha256 = "0pjk5qx16n3kvs9py62666qkwp2awkgd87by4karbj7vk6p1l14h"; fetchSubmodules = true;
22+ };
23+24+ # FIXME bitcoind doesn't die on shutdown. Need some sort of patch to fix that.
25+ #patches = [ ./shutdown-fix.patch ];
26+27+ buildInputs = [
28+ pkgconfig
29+ autoreconfHook
30+ swig
31+ qt4
32+ fcgi
33+ rsync # used by silly install script (TODO patch upstream)
34+ ];
35+36+ propagatedBuildInputs = [
37+ pyqt4
38+ psutil
39+ twisted
40+ ];
41+42+ makeFlags = [ "PREFIX=$(out)" ];
43+44+ makeWrapperArgs = [
45+ "--prefix PATH : ${bitcoin}/bin" # for `bitcoind`
46+ "--prefix PATH : ${procps}/bin" # for `free`
47+ "--prefix PATH : ${utillinux}/bin" # for `whereis`
48+ "--suffix LD_LIBRARY_PATH : $out/lib" # for python bindings built as .so files
49+ "--run cd\\ $out/lib/armory" # so that GUI resources can be loaded
50+ ];
51+52+ # auditTmpdir runs during fixupPhase, so patchelf before that
53+ preFixup = ''
54+ newRpath=$(patchelf --print-rpath $out/bin/ArmoryDB | sed -r 's|(.*)(/tmp/nix-build-.*libfcgi/.libs:?)(.*)|\1\3|')
55+ patchelf --set-rpath $out/lib:$newRpath $out/bin/ArmoryDB
56+ '';
57+58+ # fixupPhase of mkPythonDerivation wraps $out/bin/*, so this needs to come after
59+ postFixup = ''
60+ wrapPythonProgramsIn $out/lib/armory "$out $pythonPath"
61+ ln -sf $out/lib/armory/ArmoryQt.py $out/bin/armory
62+ '';
63+64+ meta = {
65+ description = "Bitcoin wallet with cold storage and multi-signature support";
66+ longDescription = ''
67+ Armory is the most secure and full featured solution available for users
68+ and institutions to generate and store Bitcoin private keys. This means
69+ users never have to trust the Armory team and can use it with the Glacier
70+ Protocol. Satoshi would be proud!
71+72+ Users are empowered with multiple encrypted Bitcoin wallets and permanent
73+ one-time ‘paper backups’. Armory pioneered cold storage and distributed
74+ multi-signature. Bitcoin cold storage is a system for securely storing
75+ Bitcoins on a completely air-gapped offline computer.
76+77+ Maintainer's note: The original authors at https://bitcoinarmory.com/
78+ discontinued development. I elected instead to package GitHub user
79+ @goatpig's fork, as it's the most active, at time of this writing.
80+ '';
81+ homepage = https://github.com/goatpig/BitcoinArmory;
82+ license = stdenv.lib.licenses.agpl3Plus;
83+ maintainers = with stdenv.lib.maintainers; [ elitak ];
84+ platforms = [ "i686-linux" "x86_64-linux" ];
85+ };
86+87+}