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