···11+{ stdenv, fetchFromGitHub, pythonPackages
22+, pkgconfig, autoreconfHook, rsync
33+, swig, qt4, fcgi
44+, bitcoin, procps, utillinux
55+}:
66+let
77+88+ version = "0.96.1";
99+ sitePackages = pythonPackages.python.sitePackages;
1010+ inherit (pythonPackages) mkPythonDerivation pyqt4 psutil twisted;
1111+1212+in mkPythonDerivation {
1313+1414+ name = "bitcoinarmory-${version}";
1515+1616+ src = fetchFromGitHub {
1717+ owner = "goatpig";
1818+ repo = "BitcoinArmory";
1919+ rev = "v${version}";
2020+ #sha256 = "023c7q1glhrkn4djz3pf28ckd1na52lsagv4iyfgchqvw7qm7yx2";
2121+ sha256 = "0pjk5qx16n3kvs9py62666qkwp2awkgd87by4karbj7vk6p1l14h"; fetchSubmodules = true;
2222+ };
2323+2424+ # FIXME bitcoind doesn't die on shutdown. Need some sort of patch to fix that.
2525+ #patches = [ ./shutdown-fix.patch ];
2626+2727+ buildInputs = [
2828+ pkgconfig
2929+ autoreconfHook
3030+ swig
3131+ qt4
3232+ fcgi
3333+ rsync # used by silly install script (TODO patch upstream)
3434+ ];
3535+3636+ propagatedBuildInputs = [
3737+ pyqt4
3838+ psutil
3939+ twisted
4040+ ];
4141+4242+ makeFlags = [ "PREFIX=$(out)" ];
4343+4444+ makeWrapperArgs = [
4545+ "--prefix PATH : ${bitcoin}/bin" # for `bitcoind`
4646+ "--prefix PATH : ${procps}/bin" # for `free`
4747+ "--prefix PATH : ${utillinux}/bin" # for `whereis`
4848+ "--suffix LD_LIBRARY_PATH : $out/lib" # for python bindings built as .so files
4949+ "--run cd\\ $out/lib/armory" # so that GUI resources can be loaded
5050+ ];
5151+5252+ # auditTmpdir runs during fixupPhase, so patchelf before that
5353+ preFixup = ''
5454+ newRpath=$(patchelf --print-rpath $out/bin/ArmoryDB | sed -r 's|(.*)(/tmp/nix-build-.*libfcgi/.libs:?)(.*)|\1\3|')
5555+ patchelf --set-rpath $out/lib:$newRpath $out/bin/ArmoryDB
5656+ '';
5757+5858+ # fixupPhase of mkPythonDerivation wraps $out/bin/*, so this needs to come after
5959+ postFixup = ''
6060+ wrapPythonProgramsIn $out/lib/armory "$out $pythonPath"
6161+ ln -sf $out/lib/armory/ArmoryQt.py $out/bin/armory
6262+ '';
6363+6464+ meta = {
6565+ description = "Bitcoin wallet with cold storage and multi-signature support";
6666+ longDescription = ''
6767+ Armory is the most secure and full featured solution available for users
6868+ and institutions to generate and store Bitcoin private keys. This means
6969+ users never have to trust the Armory team and can use it with the Glacier
7070+ Protocol. Satoshi would be proud!
7171+7272+ Users are empowered with multiple encrypted Bitcoin wallets and permanent
7373+ one-time ‘paper backups’. Armory pioneered cold storage and distributed
7474+ multi-signature. Bitcoin cold storage is a system for securely storing
7575+ Bitcoins on a completely air-gapped offline computer.
7676+7777+ Maintainer's note: The original authors at https://bitcoinarmory.com/
7878+ discontinued development. I elected instead to package GitHub user
7979+ @goatpig's fork, as it's the most active, at time of this writing.
8080+ '';
8181+ homepage = https://github.com/goatpig/BitcoinArmory;
8282+ license = stdenv.lib.licenses.agpl3Plus;
8383+ maintainers = with stdenv.lib.maintainers; [ elitak ];
8484+ platforms = [ "i686-linux" "x86_64-linux" ];
8585+ };
8686+8787+}