1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2016 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
5 ;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
6 ;;; Copyright © 2017 Carlo Zancanaro <carlo@zancanaro.id.au>
7 ;;; Copyright © 2017 Theodoros Foradis <theodoros@foradis.org>
8 ;;; Copyright © 2017 Vasile Dumitrascu <va511e@yahoo.com>
9 ;;; Copyright © 2018 Eric Bavier <bavier@member.fsf.org>
11 ;;; This file is part of GNU Guix.
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26 (define-module (gnu packages finance)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix packages)
29 #:use-module (guix download)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system cmake)
32 #:use-module (guix build-system python)
33 #:use-module (gnu packages)
34 #:use-module (gnu packages base)
35 #:use-module (gnu packages boost)
36 #:use-module (gnu packages check)
37 #:use-module (gnu packages databases)
38 #:use-module (gnu packages documentation)
39 #:use-module (gnu packages dns)
40 #:use-module (gnu packages emacs)
41 #:use-module (gnu packages graphviz)
42 #:use-module (gnu packages groff)
43 #:use-module (gnu packages libedit)
44 #:use-module (gnu packages libevent)
45 #:use-module (gnu packages libunwind)
46 #:use-module (gnu packages libusb)
47 #:use-module (gnu packages linux)
48 #:use-module (gnu packages multiprecision)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages protobuf)
51 #:use-module (gnu packages python)
52 #:use-module (gnu packages python-crypto)
53 #:use-module (gnu packages python-web)
54 #:use-module (gnu packages qt)
55 #:use-module (gnu packages readline)
56 #:use-module (gnu packages texinfo)
57 #:use-module (gnu packages textutils)
58 #:use-module (gnu packages tls)
59 #:use-module (gnu packages upnp)
60 #:use-module (gnu packages web)
61 #:use-module (gnu packages xml)
62 #:use-module (gnu packages gnuzilla))
64 (define-public bitcoin-core
71 (string-append "https://bitcoin.org/bin/bitcoin-core-"
72 version "/bitcoin-" version ".tar.gz"))
75 "1d22fgwdcn343kd95lh389hj417zwbmnhi29cij8n7wc0nz2vpil"))))
76 (build-system gnu-build-system)
78 `(("pkg-config" ,pkg-config)
79 ("python" ,python) ; for the tests
80 ("util-linux" ,util-linux) ; provides the hexdump command for tests
81 ("qttools" ,qttools)))
83 `(("bdb" ,bdb-5.3) ; with 6.2.23, there is an error: ambiguous overload
85 ("libevent" ,libevent)
86 ("miniupnpc" ,miniupnpc)
88 ("protobuf" ,protobuf)
93 ;; We use a bdb version newer than 4.8.
94 "--with-incompatible-bdb"
95 ;; Boost is not found unless specified manually.
96 (string-append "--with-boost="
97 (assoc-ref %build-inputs "boost"))
98 ;; XXX: The configure script looks up Qt paths by
99 ;; `pkg-config --variable=host_bins Qt5Core`, which fails to pick
100 ;; up executables residing in 'qttools', so we specify them here.
101 (string-append "ac_cv_path_LRELEASE="
102 (assoc-ref %build-inputs "qttools")
104 (string-append "ac_cv_path_LUPDATE="
105 (assoc-ref %build-inputs "qttools")
108 (modify-phases %standard-phases
109 (add-before 'check 'set-home
111 (setenv "HOME" (getenv "TMPDIR"))))))) ; Tests write to $HOME.
112 (home-page "https://bitcoin.org/en/")
113 (synopsis "Bitcoin peer-to-peer client")
115 "Bitcoin is a digital currency that enables instant payments to anyone
116 anywhere in the world. It uses peer-to-peer technology to operate without
117 central authority: managing transactions and issuing money are carried out
118 collectively by the network. Bitcoin Core is the reference implementation
119 of the bitcoin protocol. This package provides the Bitcoin Core command
120 line client and a client based on Qt.")
121 (license license:expat)))
123 (define-public ledger
130 "https://github.com/ledger/ledger/archive/v"
132 (file-name (string-append name "-" version ".tar.gz"))
135 "12jlv3gsjhrja25q9hrwh73cdacd2l3c2yyn8qnijav9mdhnbw4h"))
136 (patches (search-patches "ledger-revert-boost-python-fix.patch"
137 "ledger-fix-uninitialized.patch"))))
138 (build-system cmake-build-system)
140 `(#:modules ((guix build cmake-build-system)
142 (guix build emacs-utils))
143 #:imported-modules (,@%cmake-build-system-modules
144 (guix build emacs-utils))
146 `("-DBUILD_DOCS:BOOL=ON"
147 "-DBUILD_WEB_DOCS:BOOL=ON"
148 "-DBUILD_EMACSLISP:BOOL=ON"
149 "-DUSE_PYTHON:BOOL=ON"
150 "-DCMAKE_INSTALL_LIBDIR:PATH=lib"
151 ,(string-append "-DUTFCPP_INCLUDE_DIR:PATH="
152 (assoc-ref %build-inputs "utfcpp")
155 (modify-phases %standard-phases
156 (add-before 'configure 'install-examples
157 (lambda* (#:key outputs #:allow-other-keys)
158 (let ((examples (string-append (assoc-ref outputs "out")
159 "/share/doc/ledger/examples")))
160 (install-file "test/input/sample.dat" examples)
161 (install-file "test/input/demo.ledger" examples))
163 (add-after 'build 'build-doc
164 (lambda _ (zero? (system* "make" "doc"))))
165 (add-before 'check 'check-setup
166 ;; One test fails if it can't set the timezone.
167 (lambda* (#:key inputs #:allow-other-keys)
169 (string-append (assoc-ref inputs "tzdata")
172 (add-after 'install 'relocate-elisp
173 (lambda* (#:key outputs #:allow-other-keys)
174 (let* ((site-dir (string-append (assoc-ref outputs "out")
175 "/share/emacs/site-lisp"))
176 (guix-dir (string-append site-dir "/guix.d"))
177 (orig-dir (string-append site-dir "/ledger-mode"))
178 (dest-dir (string-append guix-dir "/ledger-mode")))
180 (rename-file orig-dir dest-dir)
181 (emacs-generate-autoloads ,name dest-dir))
192 `(("emacs" ,emacs-minimal)
194 ("texinfo" ,texinfo)))
195 (home-page "http://ledger-cli.org/")
196 (synopsis "Command-line double-entry accounting program")
198 "Ledger is a powerful, double-entry accounting system that is
199 accessed from the UNIX command-line. This may put off some users, since
200 there is no flashy UI, but for those who want unparalleled reporting
201 access to their data there are few alternatives.
203 Ledger uses text files for input. It reads the files and generates
204 reports; there is no other database or stored state. To use Ledger,
205 you create a file of your account names and transactions, run from the
206 command line with some options to specify input and requested reports, and
207 get output. The output is generally plain text, though you could generate
208 a graph or html instead. Ledger is simple in concept, surprisingly rich
209 in ability, and easy to use.")
210 ;; There are some extra licenses in files which do not presently get
211 ;; installed when you build this package. Different versions of the GPL
212 ;; are used in the contrib and python subdirectories. The bundled version
213 ;; of utfcpp is under the Boost 1.0 license. Also the file
214 ;; `tools/update_copyright_year` has an Expat license.
215 (license (list license:bsd-3
216 license:asl2.0 ; src/strptime.cc
217 (license:non-copyleft
218 "file://src/wcwidth.cc"
219 "See src/wcwidth.cc in the distribution.")
220 license:gpl2+)))) ; lisp/*
222 (define-public geierlein
229 (uri (string-append "https://github.com/stesie/geierlein"
230 "/archive/V" version ".tar.gz"))
231 (file-name (string-append name "-" version ".tar.gz"))
234 "0b11fq8v5w8nxjb20jl4dsfhv76xky6n3sq3k3fbb0m2sq9ikikw"))))
235 (build-system gnu-build-system)
237 `(#:tests? #f ; would require npm, python and a lot more
239 (modify-phases %standard-phases
241 (add-after 'unpack 'override-target-directory-and-tool-paths
242 (lambda* (#:key inputs outputs #:allow-other-keys)
243 (substitute* "Makefile"
245 (string-append "prefix := " (assoc-ref outputs "out") "\n"))
246 ;; Required for tests, unused for now:
248 ;; (string-append (which "python") "\n")))
250 (string-append "INSTALL := " (which "install") "\n")))
251 (substitute* "bin/xgeierlein.in"
252 ;; Use icecat as XULRUNNER
254 (string-append "XULRUNNER=" (which "icecat") "\n"
258 `(("icecat" ,icecat)))
259 (home-page "http://stesie.github.io/geierlein/")
260 (synopsis "Free Elster client, for sending Germany VAT declarations")
262 "Geierlein is a free Elster client, i.e. an application that
263 allows to send VAT declarations to Germany's fiscal authorities.
265 Currently it is *not* possible to send returns that are due annually
266 (especially the income tax return) since the fiscal authority doesn't
267 allow to do that off the ERiC library (which is proprietary however).
268 It's not clear at the moment whether one day it will be possible to
270 (license license:agpl3+)))
272 (define-public electrum
279 (uri (string-append "https://download.electrum.org/"
284 "06z0a5p1jg93jialphslip8d72q9yg3651qqaf494gs3h9kw1sv1"))
285 (modules '((guix build utils)))
288 ;; Delete the bundled dependencies.
289 (delete-file-recursively "packages")
291 (build-system python-build-system)
293 `(("python-pyaes" ,python-pyaes)
294 ("python-pysocks" ,python-pysocks)
295 ("python-sip" ,python-sip)
296 ("python-pyqt" ,python-pyqt)
297 ("python-ecdsa" ,python-ecdsa)
298 ("python-pbkdf2" ,python-pbkdf2)
299 ("python-requests" ,python-requests)
300 ("python-qrcode" ,python-qrcode)
301 ("python-protobuf" ,python-protobuf)
302 ("python-dnspython" ,python-dnspython)
303 ("python-jsonrpclib-pelix" ,python-jsonrpclib-pelix)))
305 `(#:tests? #f ;; package doesn't have any tests
307 (modify-phases %standard-phases
308 (add-before 'build 'patch-home
309 (lambda* (#:key outputs #:allow-other-keys)
310 (substitute* "setup.py"
312 (string-append (assoc-ref outputs "out") "/local/share"))))))))
313 (home-page "https://electrum.org/")
314 (synopsis "Bitcoin wallet")
316 "Electrum is a lightweight Bitcoin client, based on a client-server
317 protocol. It supports Simple Payment Verification (SPV) and deterministic key
318 generation from a seed. Your secret keys are encrypted and are never sent to
319 other machines/servers. Electrum does not download the Bitcoin blockchain.")
320 (license license:expat)))
322 (define-public monero
323 ;; This package bundles easylogging++ and lmdb.
324 ;; The bundled easylogging++ is modified, and the changes will not be upstreamed.
325 ;; The devs deem the lmdb driver too critical a consenus component, to use
326 ;; the system's dynamically linked library.
333 (uri (string-append "https://github.com/monero-project/monero/archive/v"
335 (file-name (string-append name "-" version ".tar.gz"))
336 (modules '((guix build utils)))
339 ;; Delete bundled dependencies.
341 delete-file-recursively
342 '("external/miniupnpc" "external/rapidjson"
347 "16shd834025jyzy68h3gag1sz8vbk875hy4j97hrki8pacz8vd5m"))))
348 (build-system cmake-build-system)
350 `(("doxygen" ,doxygen)
351 ("googletest" ,googletest)
352 ("graphviz" ,graphviz)
353 ("pkg-config" ,pkg-config)))
358 ("libunwind" ,libunwind)
360 ("miniupnpc" ,miniupnpc)
362 ("rapidjson" ,rapidjson)
363 ("unbound" ,unbound)))
365 `(#:out-of-source? #t
366 #:configure-flags '("-DBUILD_TESTS=ON"
367 ,@(if (string=? "aarch64-linux" (%current-system))
370 "-DBUILD_GUI_DEPS=ON")
372 (modify-phases %standard-phases
373 ;; tests/core_tests need a valid HOME
374 (add-before 'configure 'set-home
376 (setenv "HOME" (getcwd))
378 (add-after 'set-home 'fix-wallet-path-for-unit-tests
380 (substitute* "tests/unit_tests/serialization.cpp"
381 (("\\.\\./\\.\\./\\.\\./\\.\\./") "../../"))
383 (add-after 'fix-wallet-path-for-unit-tests 'change-log-path
385 (substitute* "contrib/epee/src/mlog.cpp"
386 (("epee::string_tools::get_current_module_folder\\(\\)")
388 (substitute* "contrib/epee/src/mlog.cpp"
389 (("return \\(") "return ((std::string(getenv(\"HOME\"))) / "))
394 (system* "make" "ARGS=-E 'unit_tests|libwallet_api_tests'"
396 ;; The excluded unit tests need network access
397 (add-after 'check 'unit-tests
399 (let ((excluded-unit-tests
401 '("AddressFromURL.Success"
402 "AddressFromURL.Failure"
403 "DNSResolver.IPv4Success"
404 "DNSResolver.DNSSECSuccess"
405 "DNSResolver.DNSSECFailure"
406 "DNSResolver.GetTXTRecord")
409 (system* "tests/unit_tests/unit_tests"
410 (string-append "--gtest_filter=-"
411 excluded-unit-tests))))))
412 (add-after 'install 'install-blockchain-import-export
413 (lambda* (#:key outputs #:allow-other-keys)
414 (let* ((out (assoc-ref outputs "out"))
415 (bin (string-append out "/bin")))
416 (install-file "bin/monero-blockchain-import" bin)
417 (install-file "bin/monero-blockchain-export" bin)))))))
418 (home-page "https://getmonero.org/")
419 (synopsis "Command-line interface to the Monero currency")
421 "Monero is a secure, private, untraceable currency. This package provides the
422 Monero command line client and daemon.")
423 (license license:bsd-3)))
425 (define-public monero-core
432 (uri (string-append "https://github.com/monero-project/monero-core/archive/v"
434 (file-name (string-append name "-" version ".tar.gz"))
437 "1q7a9kpcjgp74fbplzs2iszdld6gwbfrydyd9in9izhwp100p1rr"))))
438 (build-system gnu-build-system)
440 `(("doxygen" ,doxygen)
441 ("graphviz" ,graphviz)
442 ("pkg-config" ,pkg-config)))
445 ("libunwind" ,libunwind)
448 ("readline" ,readline)
449 ("unbound" ,unbound)))
451 `(("monero" ,monero)))
454 (modify-phases %standard-phases
457 (add-before 'build 'fix-makefile-vars
459 (substitute* "src/zxcvbn-c/makefile"
462 (add-after 'fix-makefile-vars 'fix-library-paths
463 (lambda* (#:key inputs #:allow-other-keys)
464 (substitute* "monero-wallet-gui.pro"
465 (("-L/usr/local/lib") "")
466 (("-L/usr/local/opt/openssl/lib")
468 (assoc-ref inputs "openssl")
470 (("-L/usr/local/opt/boost/lib")
472 (assoc-ref inputs "boost")
475 (add-after 'fix-library-paths 'fix-monerod-path
476 (lambda* (#:key inputs #:allow-other-keys)
477 (substitute* "src/daemon/DaemonManager.cpp"
478 (("QApplication::applicationDirPath\\(\\) \\+ \"/monerod")
479 (string-append "\""(assoc-ref inputs "monero")
484 (zero? (system* "./build.sh"))))
485 (add-after 'build 'fix-install-path
486 (lambda* (#:key outputs #:allow-other-keys)
487 (substitute* "build/Makefile"
488 (("/opt/monero-wallet-gui")
489 (assoc-ref outputs "out")))
491 (add-before 'install 'change-dir
494 (home-page "https://getmonero.org/")
495 (synopsis "Graphical user interface for the Monero currency")
497 "Monero is a secure, private, untraceable currency. This package provides the
499 (license license:bsd-3)))
501 (define-public python-trezor-agent
503 (name "python-trezor-agent")
508 (uri (string-append "https://github.com/romanz/trezor-agent/archive/v"
510 (file-name (string-append name "-" version ".tar.gz"))
513 "0h8jb147vpjk7mqbl4za0xdh7lblhx07n9dfk80kn2plwnvrry1x"))))
514 (build-system python-build-system)
517 (modify-phases %standard-phases
519 (add-after 'install 'check
520 (lambda* (#:key outputs inputs #:allow-other-keys)
521 ;; Make installed package available for running the tests
522 (add-installed-pythonpath inputs outputs)
523 (invoke "py.test"))))))
525 `(("python-ecdsa" ,python-ecdsa)
526 ("python-ed25519" ,python-ed25519)
527 ("python-semver" ,python-semver)
528 ("python-unidecode" ,python-unidecode)))
530 `(("python-mock" ,python-mock)
531 ("python-pytest" ,python-pytest)))
532 (home-page "https://github.com/romanz/trezor-agent")
533 (synopsis "TREZOR SSH and GPG host support")
535 "@code{libagent} is a library that allows using TREZOR, Keepkey and
536 Ledger Nano as a hardware SSH/GPG agent.")
537 (license license:lgpl3)))
539 (define-public python2-trezor-agent
540 (package-with-python2 python-trezor-agent))
542 (define-public python-mnemonic
544 (name "python-mnemonic")
549 (uri (pypi-uri "mnemonic" version))
552 "07bzfa5di6nv5xwwcwbypnflpj50wlfczhh6q6hg8w13g5m319q2"))))
553 (build-system python-build-system)
555 `(("python-pbkdf2" ,python-pbkdf2)))
556 (home-page "https://github.com/trezor/python-mnemonic")
557 (synopsis "Implementation of Bitcoin BIP-0039")
558 (description "@code{mnemonic} is a library that provides an implementation
559 of Bitcoin BIP-0039.")
560 (license license:expat)))
562 (define-public python2-mnemonic
563 (package-with-python2 python-mnemonic))
565 (define-public python-ledgerblue
567 (name "python-ledgerblue")
572 (uri (pypi-uri "ledgerblue" version))
575 "010mghaqh1cmz3a0ifc3f40mmyplilwlw7kpha2mzyrrff46p9gb"))))
576 (build-system python-build-system)
578 `(("python-ecpy" ,python-ecpy)
579 ("python-future" ,python-future)
580 ("python-hidapi" ,python-hidapi)
581 ("python-pillow" ,python-pillow)
582 ("python-protobuf" ,python-protobuf)
583 ("python-pycrypto" ,python-pycrypto)))
584 (home-page "https://github.com/LedgerHQ/blue-loader-python")
585 (synopsis "Python library to communicate with Ledger Blue/Nano S")
586 (description "@code{ledgerblue} is a Python library to communicate with
587 Ledger Blue/Nano S.")
588 (license license:asl2.0)))
590 (define-public python2-ledgerblue
591 (package-with-python2 python-ledgerblue))
593 (define-public python-trezor
595 (name "python-trezor")
600 (uri (pypi-uri "trezor" version))
603 "055kii56wgwadl5z911s59ya2fnsqzk3n5i19s2hb9sv2by6knvb"))))
604 (build-system python-build-system)
606 `(("python-ecdsa" ,python-ecdsa)
607 ("python-hidapi" ,python-hidapi)
608 ("python-mnemonic" ,python-mnemonic)
609 ("python-protobuf" ,python-protobuf)
610 ("python-requests" ,python-requests)))
612 `(("python-pyqt" ,python-pyqt))) ; Tests
613 (home-page "https://github.com/trezor/python-trezor")
614 (synopsis "Python library for communicating with TREZOR Hardware Wallet")
615 (description "@code{trezor} is a Python library for communicating with
616 TREZOR Hardware Wallet.")
617 (license license:lgpl3)))
619 (define-public python2-trezor
620 (package-with-python2 python-trezor))
622 (define-public python-keepkey
624 (name "python-keepkey")
629 (uri (pypi-uri "keepkey" version))
632 "0f4iqqjlqmamw4mhyhik4qlb5bnfd10wbjw9yzgir105wh5fdpnd"))))
633 (build-system python-build-system)
636 (modify-phases %standard-phases
638 (add-after 'install 'check
639 (lambda* (#:key inputs outputs #:allow-other-keys)
640 (add-installed-pythonpath inputs outputs)
641 (apply invoke "python" (find-files "tests/unit" "\\.py$")))))))
643 `(("python-ecdsa" ,python-ecdsa)
644 ("python-hidapi" ,python-hidapi)
645 ("python-mnemonic" ,python-mnemonic)
646 ("python-protobuf" ,python-protobuf)))
647 (home-page "https://github.com/keepkey/python-keepkey")
648 (synopsis "Python library for communicating with KeepKey Hardware Wallet")
649 (description "@code{keepkey} is a Python library for communicating with
650 the KeepKey Hardware Wallet.")
651 (license license:lgpl3)))
653 (define-public python2-keepkey
654 (package-with-python2 python-keepkey))
656 (define-public ledger-agent
658 (name "ledger-agent")
663 (uri (pypi-uri "ledger_agent" version))
666 "03zj602m2rln9yvr08dswy56vzkbldp8b074ixwzz525dafblr92"))))
667 (build-system python-build-system)
669 `(("python-ledgerblue" ,python-ledgerblue)
670 ("python-trezor-agent" ,python-trezor-agent)))
671 (home-page "http://github.com/romanz/trezor-agent")
672 (synopsis "Ledger as hardware SSH/GPG agent")
673 (description "This package allows using Ledger as hardware SSH/GPG agent.
675 Usage for SSH: trezor-agent foo@@example.com --connect
676 Usage for GPG: Initialize using trezor-gpg init \"Foo <foo@@example.com>\"
677 Then set the environment variable GNUPGHOME to
678 \"${HOME}/.gnupg/trezor\".")
679 (license license:lgpl3)))
681 (define-public trezor-agent
683 (name "trezor-agent")
688 (uri (pypi-uri "trezor_agent" version))
691 "1i5cdamlf3c0ym600pjklij74p8ifj9cv7xrpnrfl1b8nkadswbz"))))
692 (build-system python-build-system)
694 `(("python-trezor" ,python-trezor)
695 ("python-trezor-agent" ,python-trezor-agent)))
696 (home-page "http://github.com/romanz/trezor-agent")
697 (synopsis "Using Trezor as hardware SSH/GPG agent")
698 (description "This package allows using Trezor as a hardware SSH/GPG
700 (license license:lgpl3)))
702 (define-public keepkey-agent
704 (name "keepkey-agent")
709 (uri (pypi-uri "keepkey_agent" version))
712 "03779gvlx70i0nnry98i4pl1d92604ix5x6jgdfkrdgzqbh5vj27"))))
713 (build-system python-build-system)
715 `(("python-keepkey" ,python-keepkey)
716 ("python-trezor-agent" ,python-trezor-agent)))
717 (home-page "http://github.com/romanz/trezor-agent")
718 (synopsis "KeepKey as hardware SSH/GPG agent")
719 (description "This package allows using KeepKey as a hardware SSH/GPG
721 (license license:lgpl3)))