gnu: Add python-trezor-agent.
[jackhill/guix/guix.git] / gnu / packages / finance.scm
CommitLineData
20c6b9da 1;;; GNU Guix --- Functional package management for GNU
fe7fa353 2;;; Copyright © 2015, 2016 Andreas Enge <andreas@enge.fr>
fa7647c6 3;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
d3699b31 4;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
cb0866c3 5;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
9475fd92 6;;; Copyright © 2017 Carlo Zancanaro <carlo@zancanaro.id.au>
8514662b 7;;; Copyright © 2017 Theodoros Foradis <theodoros@foradis.org>
14e09e90 8;;; Copyright © 2017 Vasile Dumitrascu <va511e@yahoo.com>
20c6b9da
AE
9;;;
10;;; This file is part of GNU Guix.
11;;;
12;;; GNU Guix is free software; you can redistribute it and/or modify it
13;;; under the terms of the GNU General Public License as published by
14;;; the Free Software Foundation; either version 3 of the License, or (at
15;;; your option) any later version.
16;;;
17;;; GNU Guix is distributed in the hope that it will be useful, but
18;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;;; GNU General Public License for more details.
21;;;
22;;; You should have received a copy of the GNU General Public License
23;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25(define-module (gnu packages finance)
fa4f95a7
CB
26 #:use-module ((guix licenses) #:prefix license:)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix build-system cmake)
31 #:use-module (guix build-system python)
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages boost)
34 #:use-module (gnu packages check)
35 #:use-module (gnu packages databases)
36 #:use-module (gnu packages documentation)
37 #:use-module (gnu packages dns)
38 #:use-module (gnu packages emacs)
39 #:use-module (gnu packages graphviz)
40 #:use-module (gnu packages groff)
41 #:use-module (gnu packages libedit)
42 #:use-module (gnu packages libevent)
43 #:use-module (gnu packages libunwind)
44 #:use-module (gnu packages linux)
45 #:use-module (gnu packages multiprecision)
46 #:use-module (gnu packages pkg-config)
47 #:use-module (gnu packages protobuf)
48 #:use-module (gnu packages python)
cc6f4912 49 #:use-module (gnu packages python-crypto)
589e3f4e 50 #:use-module (gnu packages python-web)
fa4f95a7 51 #:use-module (gnu packages qt)
1d0865c1 52 #:use-module (gnu packages readline)
fa4f95a7
CB
53 #:use-module (gnu packages texinfo)
54 #:use-module (gnu packages textutils)
55 #:use-module (gnu packages tls)
56 #:use-module (gnu packages upnp)
57 #:use-module (gnu packages web)
58 #:use-module (gnu packages xml)
59 #:use-module (gnu packages gnuzilla))
20c6b9da
AE
60
61(define-public bitcoin-core
62 (package
63 (name "bitcoin-core")
0632c6a8 64 (version "0.15.1")
20c6b9da
AE
65 (source (origin
66 (method url-fetch)
67 (uri
68 (string-append "https://bitcoin.org/bin/bitcoin-core-"
14ea30e4 69 version "/bitcoin-" version ".tar.gz"))
20c6b9da
AE
70 (sha256
71 (base32
0632c6a8 72 "1d22fgwdcn343kd95lh389hj417zwbmnhi29cij8n7wc0nz2vpil"))))
20c6b9da
AE
73 (build-system gnu-build-system)
74 (native-inputs
75 `(("pkg-config" ,pkg-config)
e49e74f5 76 ("python" ,python) ; for the tests
0193812a
MB
77 ("util-linux" ,util-linux) ; provides the hexdump command for tests
78 ("qttools" ,qttools)))
20c6b9da 79 (inputs
fe7fa353 80 `(("bdb" ,bdb-5.3) ; with 6.2.23, there is an error: ambiguous overload
20c6b9da 81 ("boost" ,boost)
14ea30e4 82 ("libevent" ,libevent)
20c6b9da
AE
83 ("miniupnpc" ,miniupnpc)
84 ("openssl" ,openssl)
85 ("protobuf" ,protobuf)
0193812a 86 ("qtbase" ,qtbase)))
20c6b9da
AE
87 (arguments
88 `(#:configure-flags
89 (list
90 ;; We use a bdb version newer than 4.8.
91 "--with-incompatible-bdb"
92 ;; Boost is not found unless specified manually.
93 (string-append "--with-boost="
0193812a
MB
94 (assoc-ref %build-inputs "boost"))
95 ;; XXX: The configure script looks up Qt paths by
96 ;; `pkg-config --variable=host_bins Qt5Core`, which fails to pick
97 ;; up executables residing in 'qttools', so we specify them here.
98 (string-append "ac_cv_path_LRELEASE="
99 (assoc-ref %build-inputs "qttools")
100 "/bin/lrelease")
101 (string-append "ac_cv_path_LUPDATE="
102 (assoc-ref %build-inputs "qttools")
103 "/bin/lupdate"))
20c6b9da
AE
104 #:phases
105 (modify-phases %standard-phases
106 (add-before 'check 'set-home
107 (lambda _
108 (setenv "HOME" (getenv "TMPDIR"))))))) ; Tests write to $HOME.
109 (home-page "https://bitcoin.org/en/")
110 (synopsis "Bitcoin peer-to-peer client")
111 (description
112 "Bitcoin is a digital currency that enables instant payments to anyone
113anywhere in the world. It uses peer-to-peer technology to operate without
114central authority: managing transactions and issuing money are carried out
115collectively by the network. Bitcoin Core is the reference implementation
116of the bitcoin protocol. This package provides the Bitcoin Core command
117line client and a client based on Qt.")
118 (license license:expat)))
d3699b31
AG
119
120(define-public ledger
121 (package
122 (name "ledger")
123 (version "3.1.1")
124 (source (origin
125 (method url-fetch)
126 (uri (string-append
127 "https://github.com/ledger/ledger/archive/v"
128 version ".tar.gz"))
129 (file-name (string-append name "-" version ".tar.gz"))
130 (sha256
131 (base32
132 "12jlv3gsjhrja25q9hrwh73cdacd2l3c2yyn8qnijav9mdhnbw4h"))))
133 (build-system cmake-build-system)
134 (arguments
135 `(#:modules ((guix build cmake-build-system)
136 (guix build utils)
137 (guix build emacs-utils))
138 #:imported-modules (,@%cmake-build-system-modules
139 (guix build emacs-utils))
140 #:configure-flags
141 `("-DBUILD_DOCS:BOOL=ON"
142 "-DBUILD_WEB_DOCS:BOOL=ON"
143 "-DBUILD_EMACSLISP:BOOL=ON"
144 "-DUSE_PYTHON:BOOL=ON"
145 "-DCMAKE_INSTALL_LIBDIR:PATH=lib"
146 ,(string-append "-DUTFCPP_INCLUDE_DIR:PATH="
147 (assoc-ref %build-inputs "utfcpp")
148 "/include"))
149 #:phases
150 (modify-phases %standard-phases
151 (add-before 'configure 'install-examples
152 (lambda* (#:key outputs #:allow-other-keys)
153 (let ((examples (string-append (assoc-ref outputs "out")
154 "/share/doc/ledger/examples")))
155 (install-file "test/input/sample.dat" examples)
156 (install-file "test/input/demo.ledger" examples))
157 #t))
158 (add-after 'build 'build-doc
159 (lambda _ (zero? (system* "make" "doc"))))
160 (add-before 'check 'check-setup
161 ;; One test fails if it can't set the timezone.
162 (lambda* (#:key inputs #:allow-other-keys)
163 (setenv "TZDIR"
164 (string-append (assoc-ref inputs "tzdata")
165 "/share/zoneinfo"))
166 #t))
167 (add-after 'install 'relocate-elisp
168 (lambda* (#:key outputs #:allow-other-keys)
169 (let* ((site-dir (string-append (assoc-ref outputs "out")
170 "/share/emacs/site-lisp"))
171 (guix-dir (string-append site-dir "/guix.d"))
172 (orig-dir (string-append site-dir "/ledger-mode"))
173 (dest-dir (string-append guix-dir "/ledger-mode")))
174 (mkdir-p guix-dir)
175 (rename-file orig-dir dest-dir)
176 (emacs-generate-autoloads ,name dest-dir))
177 #t)))))
178 (inputs
179 `(("boost" ,boost)
180 ("gmp" ,gmp)
181 ("libedit" ,libedit)
182 ("mpfr" ,mpfr)
183 ("python" ,python-2)
184 ("tzdata" ,tzdata)
185 ("utfcpp" ,utfcpp)))
186 (native-inputs
b8fc3622 187 `(("emacs" ,emacs-minimal)
d3699b31
AG
188 ("groff" ,groff)
189 ("texinfo" ,texinfo)))
190 (home-page "http://ledger-cli.org/")
191 (synopsis "Command-line double-entry accounting program")
192 (description
193 "Ledger is a powerful, double-entry accounting system that is
194accessed from the UNIX command-line. This may put off some users, since
195there is no flashy UI, but for those who want unparalleled reporting
196access to their data there are few alternatives.
197
198Ledger uses text files for input. It reads the files and generates
199reports; there is no other database or stored state. To use Ledger,
200you create a file of your account names and transactions, run from the
201command line with some options to specify input and requested reports, and
202get output. The output is generally plain text, though you could generate
203a graph or html instead. Ledger is simple in concept, surprisingly rich
204in ability, and easy to use.")
205 ;; There are some extra licenses in files which do not presently get
206 ;; installed when you build this package. Different versions of the GPL
207 ;; are used in the contrib and python subdirectories. The bundled version
208 ;; of utfcpp is under the Boost 1.0 license. Also the file
209 ;; `tools/update_copyright_year` has an Expat license.
210 (license (list license:bsd-3
211 license:asl2.0 ; src/strptime.cc
212 (license:non-copyleft
213 "file://src/wcwidth.cc"
214 "See src/wcwidth.cc in the distribution.")
215 license:gpl2+)))) ; lisp/*
cb0866c3
HG
216
217(define-public geierlein
218 (package
219 (name "geierlein")
220 (version "0.9.5")
221 (source
222 (origin
223 (method url-fetch)
224 (uri (string-append "https://github.com/stesie/geierlein"
225 "/archive/V" version ".tar.gz"))
226 (file-name (string-append name "-" version ".tar.gz"))
227 (sha256
228 (base32
229 "0b11fq8v5w8nxjb20jl4dsfhv76xky6n3sq3k3fbb0m2sq9ikikw"))))
230 (build-system gnu-build-system)
231 (arguments
232 `(#:tests? #f ; would require npm, python and a lot more
233 #:phases
234 (modify-phases %standard-phases
235 (delete 'configure)
236 (add-after 'unpack 'override-target-directory-and-tool-paths
237 (lambda* (#:key inputs outputs #:allow-other-keys)
238 (substitute* "Makefile"
239 (("prefix := .*")
240 (string-append "prefix := " (assoc-ref outputs "out") "\n"))
241 ;; Required for tests, unused for now:
242 ;;(("PYTHON := .*")
243 ;; (string-append (which "python") "\n")))
244 (("INSTALL := .*")
245 (string-append "INSTALL := " (which "install") "\n")))
246 (substitute* "bin/xgeierlein.in"
247 ;; Use icecat as XULRUNNER
248 (("^for search ")
249 (string-append "XULRUNNER=" (which "icecat") "\n"
250 "for search ")))
251 #t)))))
252 (inputs
253 `(("icecat" ,icecat)))
254 (home-page "http://stesie.github.io/geierlein/")
255 (synopsis "Free Elster client, for sending Germany VAT declarations")
256 (description
257 "Geierlein is a free Elster client, i.e. an application that
258allows to send VAT declarations to Germany's fiscal authorities.
259
260Currently it is *not* possible to send returns that are due annually
261(especially the income tax return) since the fiscal authority doesn't
262allow to do that off the ERiC library (which is proprietary however).
263It's not clear at the moment whether one day it will be possible to
264do so.")
265 (license license:agpl3+)))
9475fd92
CZ
266
267(define-public electrum
268 (package
269 (name "electrum")
47bd32d9 270 (version "3.0")
9475fd92
CZ
271 (source
272 (origin
273 (method url-fetch)
274 (uri (string-append "https://download.electrum.org/"
275 version "/Electrum-"
276 version ".tar.gz"))
277 (sha256
278 (base32
47bd32d9 279 "184cmpfqcznnm0wfjiarb6dps2vs0s2aykmy2ji7p77x20fbisfi"))
9475fd92
CZ
280 (modules '((guix build utils)))
281 (snippet
282 '(begin
283 ;; Delete the bundled dependencies.
284 (delete-file-recursively "packages")
285 #t))))
286 (build-system python-build-system)
287 (inputs
47bd32d9
CZ
288 `(("python-pyaes" ,python-pyaes)
289 ("python-pysocks" ,python-pysocks)
290 ("python-sip" ,python-sip)
291 ("python-pyqt" ,python-pyqt)
292 ("python-ecdsa" ,python-ecdsa)
293 ("python-pbkdf2" ,python-pbkdf2)
294 ("python-requests" ,python-requests)
295 ("python-qrcode" ,python-qrcode)
296 ("python-protobuf" ,python-protobuf)
297 ("python-dnspython" ,python-dnspython)
298 ("python-jsonrpclib-pelix" ,python-jsonrpclib-pelix)))
9475fd92 299 (arguments
47bd32d9 300 `(#:tests? #f ;; package doesn't have any tests
9475fd92
CZ
301 #:phases
302 (modify-phases %standard-phases
303 (add-before 'build 'patch-home
304 (lambda* (#:key outputs #:allow-other-keys)
305 (substitute* "setup.py"
306 (("~/.local/share")
307 (string-append (assoc-ref outputs "out") "/local/share"))))))))
308 (home-page "https://electrum.org/")
309 (synopsis "Bitcoin wallet")
310 (description
311 "Electrum is a lightweight Bitcoin client, based on a client-server
312protocol. It supports Simple Payment Verification (SPV) and deterministic key
313generation from a seed. Your secret keys are encrypted and are never sent to
314other machines/servers. Electrum does not download the Bitcoin blockchain.")
315 (license license:expat)))
8514662b
TF
316
317(define-public monero
318 ;; This package bundles easylogging++ and lmdb.
319 ;; The bundled easylogging++ is modified, and the changes will not be upstreamed.
320 ;; The devs deem the lmdb driver too critical a consenus component, to use
321 ;; the system's dynamically linked library.
322 (package
323 (name "monero")
14e09e90 324 (version "0.11.1.0")
8514662b
TF
325 (source
326 (origin
327 (method url-fetch)
328 (uri (string-append "https://github.com/monero-project/monero/archive/v"
329 version ".tar.gz"))
330 (file-name (string-append name "-" version ".tar.gz"))
331 (modules '((guix build utils)))
332 (snippet
333 '(begin
334 ;; Delete bundled dependencies.
335 (for-each
336 delete-file-recursively
337 '("external/miniupnpc" "external/rapidjson"
338 "external/unbound"))
339 #t))
340 (sha256
341 (base32
14e09e90 342 "16shd834025jyzy68h3gag1sz8vbk875hy4j97hrki8pacz8vd5m"))))
8514662b
TF
343 (build-system cmake-build-system)
344 (native-inputs
345 `(("doxygen" ,doxygen)
346 ("googletest" ,googletest)
347 ("graphviz" ,graphviz)
348 ("pkg-config" ,pkg-config)))
349 (inputs
350 `(("bind" ,isc-bind)
351 ("boost" ,boost)
352 ("expat" ,expat)
353 ("libunwind" ,libunwind)
354 ("lmdb" ,lmdb)
355 ("miniupnpc" ,miniupnpc)
356 ("openssl" ,openssl)
357 ("rapidjson" ,rapidjson)
358 ("unbound" ,unbound)))
359 (arguments
360 `(#:out-of-source? #t
361 #:configure-flags '("-DBUILD_TESTS=ON"
fa7647c6
EF
362 ,@(if (string=? "aarch64-linux" (%current-system))
363 '("-DARCH=armv8-a")
364 '())
8514662b
TF
365 "-DBUILD_GUI_DEPS=ON")
366 #:phases
367 (modify-phases %standard-phases
368 ;; tests/core_tests need a valid HOME
369 (add-before 'configure 'set-home
370 (lambda _
371 (setenv "HOME" (getcwd))
372 #t))
373 (add-after 'set-home 'fix-wallet-path-for-unit-tests
374 (lambda _
375 (substitute* "tests/unit_tests/serialization.cpp"
376 (("\\.\\./\\.\\./\\.\\./\\.\\./") "../../"))
377 #t))
378 (add-after 'fix-wallet-path-for-unit-tests 'change-log-path
379 (lambda _
380 (substitute* "contrib/epee/src/mlog.cpp"
381 (("epee::string_tools::get_current_module_folder\\(\\)")
382 "\".bitmonero\""))
383 (substitute* "contrib/epee/src/mlog.cpp"
384 (("return \\(") "return ((std::string(getenv(\"HOME\"))) / "))
385 #t))
386 (replace 'check
387 (lambda _
388 (zero?
389 (system* "make" "ARGS=-E 'unit_tests|libwallet_api_tests'"
390 "test"))))
391 ;; The excluded unit tests need network access
392 (add-after 'check 'unit-tests
393 (lambda _
394 (let ((excluded-unit-tests
395 (string-join
396 '("AddressFromURL.Success"
397 "AddressFromURL.Failure"
398 "DNSResolver.IPv4Success"
399 "DNSResolver.DNSSECSuccess"
400 "DNSResolver.DNSSECFailure"
401 "DNSResolver.GetTXTRecord")
402 ":")))
403 (zero?
404 (system* "tests/unit_tests/unit_tests"
405 (string-append "--gtest_filter=-"
406 excluded-unit-tests))))))
407 (add-after 'install 'install-blockchain-import-export
408 (lambda* (#:key outputs #:allow-other-keys)
409 (let* ((out (assoc-ref outputs "out"))
410 (bin (string-append out "/bin")))
411 (install-file "bin/monero-blockchain-import" bin)
412 (install-file "bin/monero-blockchain-export" bin)))))))
413 (home-page "https://getmonero.org/")
414 (synopsis "Command-line interface to the Monero currency")
415 (description
416 "Monero is a secure, private, untraceable currency. This package provides the
417Monero command line client and daemon.")
418 (license license:bsd-3)))
79228a52
TF
419
420(define-public monero-core
421 (package
422 (name "monero-core")
12a130b0 423 (version "0.11.1.0")
79228a52
TF
424 (source
425 (origin
426 (method url-fetch)
427 (uri (string-append "https://github.com/monero-project/monero-core/archive/v"
428 version ".tar.gz"))
429 (file-name (string-append name "-" version ".tar.gz"))
430 (sha256
431 (base32
12a130b0 432 "1q7a9kpcjgp74fbplzs2iszdld6gwbfrydyd9in9izhwp100p1rr"))))
79228a52
TF
433 (build-system gnu-build-system)
434 (native-inputs
435 `(("doxygen" ,doxygen)
436 ("graphviz" ,graphviz)
437 ("pkg-config" ,pkg-config)))
438 (inputs
439 `(("boost" ,boost)
440 ("libunwind" ,libunwind)
441 ("openssl" ,openssl)
442 ("qt" ,qt)
1d0865c1 443 ("readline" ,readline)
79228a52
TF
444 ("unbound" ,unbound)))
445 (propagated-inputs
446 `(("monero" ,monero)))
447 (arguments
448 `(#:phases
449 (modify-phases %standard-phases
450 (delete 'configure)
451 (delete 'check)
452 (add-before 'build 'fix-makefile-vars
453 (lambda _
454 (substitute* "src/zxcvbn-c/makefile"
455 (("\\?=") "="))
456 #t))
457 (add-after 'fix-makefile-vars 'fix-library-paths
458 (lambda* (#:key inputs #:allow-other-keys)
459 (substitute* "monero-wallet-gui.pro"
460 (("-L/usr/local/lib") "")
461 (("-L/usr/local/opt/openssl/lib")
462 (string-append "-L"
463 (assoc-ref inputs "openssl")
464 "/lib"))
465 (("-L/usr/local/opt/boost/lib")
466 (string-append "-L"
467 (assoc-ref inputs "boost")
468 "/lib")))
469 #t))
470 (add-after 'fix-library-paths 'fix-monerod-path
471 (lambda* (#:key inputs #:allow-other-keys)
472 (substitute* "src/daemon/DaemonManager.cpp"
473 (("QApplication::applicationDirPath\\(\\) \\+ \"/monerod")
474 (string-append "\""(assoc-ref inputs "monero")
475 "/bin/monerod")))
476 #t))
477 (replace 'build
478 (lambda _
479 (zero? (system* "./build.sh"))))
480 (add-after 'build 'fix-install-path
481 (lambda* (#:key outputs #:allow-other-keys)
482 (substitute* "build/Makefile"
483 (("/opt/monero-wallet-gui")
484 (assoc-ref outputs "out")))
485 #t))
486 (add-before 'install 'change-dir
487 (lambda _
488 (chdir "build"))))))
489 (home-page "https://getmonero.org/")
490 (synopsis "Graphical user interface for the Monero currency")
491 (description
492 "Monero is a secure, private, untraceable currency. This package provides the
493Monero GUI client.")
494 (license license:bsd-3)))
00d3f022
DM
495
496(define-public python-trezor-agent
497 (package
498 (name "python-trezor-agent")
499 (version "0.9.4")
500 (source
501 (origin
502 (method url-fetch)
503 (uri (string-append "https://github.com/romanz/trezor-agent/archive/v"
504 version ".tar.gz"))
505 (file-name (string-append name "-" version ".tar.gz"))
506 (sha256
507 (base32
508 "0h8jb147vpjk7mqbl4za0xdh7lblhx07n9dfk80kn2plwnvrry1x"))))
509 (build-system python-build-system)
510 (arguments
511 `(#:phases
512 (modify-phases %standard-phases
513 (delete 'check)
514 (add-after 'install 'check
515 (lambda* (#:key outputs inputs #:allow-other-keys)
516 ;; Make installed package available for running the tests
517 (add-installed-pythonpath inputs outputs)
518 (invoke "py.test"))))))
519 (propagated-inputs
520 `(("python-ecdsa" ,python-ecdsa)
521 ("python-ed25519" ,python-ed25519)
522 ("python-semver" ,python-semver)
523 ("python-unidecode" ,python-unidecode)))
524 (native-inputs
525 `(("python-mock" ,python-mock)
526 ("python-pytest" ,python-pytest)))
527 (home-page "https://github.com/romanz/trezor-agent")
528 (synopsis "TREZOR SSH and GPG host support")
529 (description
530 "@code{libagent} is a library that allows using TREZOR, Keepkey and
531Ledger Nano as a hardware SSH/GPG agent.")
532 (license license:lgpl3)))
533
534(define-public python2-trezor-agent
535 (package-with-python2 python-trezor-agent))