[PATCH] Add xmrig and p2pool

OpenSubmitted by Justin Veilleux.
Details
3 participants
  • Ludovic Courtès
  • Maxime Devos
  • Justin Veilleux
Owner
unassigned
Severity
normal
J
J
Justin Veilleux wrote on 20 Feb 00:12 +0100
(address . guix-patches@gnu.org)
356b1509-0df9-6579-d440-95bc74c9f2e3@cock.li
Here are two patches to add, respectively, the xmrig monero mining
software and p2pool, a decentralized mining pool.

Cheers
From 912cc0657b3de6eca9771f11b6bdade0fa24ddcc Mon Sep 17 00:00:00 2001
From: terramorpha <terramorpha@cock.li>
Date: Sat, 19 Feb 2022 18:07:42 -0500
Subject: [PATCH 2/2] gnu: Add p2pool.

* gnu/packages/finance.scm (p2pool): New variable.
---
gnu/packages/finance.scm | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)

Toggle diff (56 lines)
diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm
index 6d4e71ee24..ae344f010c 100644
--- a/gnu/packages/finance.scm
+++ b/gnu/packages/finance.scm
@@ -82,6 +82,7 @@ (define-module (gnu packages finance)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages graphviz)
   #:use-module (gnu packages groff)
+  #:use-module (gnu packages gsasl)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages haskell-check)
   #:use-module (gnu packages haskell-web)
@@ -897,6 +898,41 @@ (define-public xmrig
 and RandomX benchmark.")
     (license license:gpl3)))
 
+(define-public p2pool
+  (package
+    (name "p2pool")
+    (version "1.7")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/SChernykh/p2pool")
+             (commit (string-append "v" version))
+             (recursive? #t)))
+       (sha256 (base32 "0jxl7j8x4nc65c8mdilifqy1gz1881g3qmmi48wvpciv8pbw45x2"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      ;; There are no tests.
+      #:tests? #f
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'install 'install-p2pool
+            ;; The 'install' target forgets to install the binary
+            (lambda* (#:key outputs #:allow-other-keys)
+              (use-modules (guix build utils))
+              (install-file "p2pool" (string-append (assoc-ref outputs "out") "/bin"))
+              #t)))))
+    (inputs
+     (list libuv zeromq gss))
+    (home-page "https://p2pool.io/")
+    (synopsis "Decentralized Monero mining pool")
+    (description "Monero P2Pool is a peer-to-peer Monero mining pool.  P2Pool
+combines the advantages of pool and solo mining; you still fully control your
+Monero node and what it mines, but you get frequent payouts like on a regular
+pool.")
+    (license license:gpl3)))
+
 (define-public python-trezor-agent
   ;; It is called 'libagent' in pypi; i.e. this is the library as opposed to
   ;; the toplevel app called trezor-agent.
-- 
2.34.0
From 13e1d1b98f105b7c9d24735f7d05a6ec8b6b8e0b Mon Sep 17 00:00:00 2001
From: terramorpha <terramorpha@cock.li>
Date: Sat, 19 Feb 2022 14:34:50 -0500
Subject: [PATCH 1/2] gnu: Add xmrig.

* gnu/packages/finance.scm (xmrig): New variable.
---
gnu/packages/finance.scm | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)

Toggle diff (67 lines)
diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm
index 985eaa87f7..6d4e71ee24 100644
--- a/gnu/packages/finance.scm
+++ b/gnu/packages/finance.scm
@@ -26,6 +26,7 @@
 ;;; Copyright © 2021 François J <francois-oss@avalenn.eu>
 ;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com>
 ;;; Copyright © 2021 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2022 Justin Veilleux <terramorpha@cock.li>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -93,6 +94,7 @@ (define-module (gnu packages finance)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages man)
   #:use-module (gnu packages maths)
+  #:use-module (gnu packages mpi)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages networking)
@@ -857,6 +859,44 @@ (define-public monero-gui
 the Monero GUI client.")
     (license license:bsd-3)))
 
+(define-public xmrig
+  (package
+    (name "xmrig")
+    (version "6.16.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/xmrig/xmrig")
+         (commit (string-append "v" version))))
+       (sha256 (base32 "0mp7q14pfbdjvjai6nw6psqakr1hnzkkn4c51iw578866n2lmxw5"))))
+    (build-system cmake-build-system)
+    (inputs
+     (list
+      `(,hwloc "lib")
+      libuv
+      openssl))
+    (arguments
+     (list
+      ;; There are no tests.
+      #:tests? #f
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'install
+            ;; There is no 'install' target, we must install xmrig manually
+            (lambda* (#:key outputs #:allow-other-keys)
+              (use-modules (guix build utils))
+              (install-file "xmrig" (string-append (assoc-ref outputs "out") "/bin"))
+              #t)))))
+    (home-page "https://xmrig.com/")
+    (synopsis "XMR miner")
+    (description
+     "XMRig is a high performance, open source, cross platform
+RandomX, KawPow, CryptoNight, AstroBWT and GhostRider unified CPU/GPU miner
+and RandomX benchmark.")
+    (license license:gpl3)))
+
 (define-public python-trezor-agent
   ;; It is called 'libagent' in pypi; i.e. this is the library as opposed to
   ;; the toplevel app called trezor-agent.
-- 
2.34.0
M
M
Maxime Devos wrote on 20 Feb 11:14 +0100
03ebf85429e892ee4700824023506ec24b945a51.camel@telenet.be
Justin Veilleux schreef op za 19-02-2022 om 18:12 [-0500]:
Toggle quote (7 lines)
> +      #~(modify-phases %standard-phases
> +          (replace 'install
> +            ;; There is no 'install' target, we must install xmrig
> manually
> +            (lambda* (#:key outputs #:allow-other-keys)
> +              (use-modules (guix build utils))

'use-modules' currently only behaves well on the top-level, I recommend
moving it into #:modules (see e.g. glibc).

Toggle quote (3 lines)
> +              (install-file "xmrig" (string-append (assoc-ref
> outputs "out") "/bin"))

This can be simplified a little by replacing (assoc-ref outputs "out")
--> #$output.

Toggle quote (2 lines)
> +              #t)))))

Phases don't have to return #t anymore, this can be removed.

Toggle quote (3 lines)
> +    (home-page "https://xmrig.com/")
> +    (synopsis "XMR miner")

I think ‘Monero miner’ would be more descriptive.

Toggle quote (6 lines)
> +    (description
> +     "XMRig is a high performance, open source, cross platform
> +RandomX, KawPow, CryptoNight, AstroBWT and GhostRider unified
> CPU/GPU miner
> +and RandomX benchmark.")

This notes many positive qualities of XMRig, but ignores the negative
quantities. Perhaps you could add something about high energy
consumption? (See recent thread ‘Excessively energy-consuming software
considered malware?’ on guix-devel (not yet on lists.gnu.org
apparently).)

(I'm assuming here the situation is the same as for Bitcoin, but
I don't actually know if this is the case.)

Toggle quote (2 lines)
> +    (license license:gpl3)))

Looking at
appears to be gpl3+.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYhIUhBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7qSnAP9LzVrFi6ThYkUwoKD64s/bSg0y
a7xdh+WvUljJDaG56gD+PCZ4SEv6SzaZ63bRp7gvp2XPZ7PDXIZ0eR+BnA+88QM=
=zweV
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 20 Feb 11:17 +0100
e72cb58ed01fb6ac11ef7327b4c50b9104017199.camel@telenet.be
Justin Veilleux schreef op za 19-02-2022 om 18:12 [-0500]:
Toggle quote (10 lines)
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri
> +        (git-reference
> +         (url "https://github.com/xmrig/xmrig")
> +         (commit (string-append "v" version))))
> +       (sha256 (base32
> "0mp7q14pfbdjvjai6nw6psqakr1hnzkkn4c51iw578866n2lmxw5"))))

I'm seeing some bundling in 'src/3rdparty'. Also, bin/WinRing0
contains a binary. Could things be unbundled and the binary be
removed?

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYhIVJRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7kPmAQCm6CLZTr90fn47x/rYlpU9dZbP
mzYLo0l2uY5m1LBofgEApDgtKjLI8HT0idMbZmLW6Xz4P6P8vlyUxryaPRp+vAI=
=K680
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 5 Apr 16:05 +0200
Re: bug#54068: [PATCH] Add xmrig and p2pool
(name . Justin Veilleux)(address . terramorpha@cock.li)
87pmlvmxqq.fsf_-_@gnu.org
Hi Justin,

Did you have a chance to look at Maxime’s feedback? It would be great
if you could address it and send updated patches.


TIA,
Ludo’.
L
L
Ludovic Courtès wrote on 5 Apr 16:05 +0200
control message for bug #54068
(address . control@debbugs.gnu.org)
87o81fmxqf.fsf@gnu.org
tags 54068 + moreinfo
quit
J
J
Justin Veilleux wrote on 5 Apr 20:57 +0200
Re: bug#54068: [PATCH] Add xmrig and p2pool
(name . Ludovic Courtès)(address . ludo@gnu.org)
73ba1436-5434-c771-258d-d3a97f3ff5df@cock.li
Hi.

Most issues Maxime raised I can solve easily. The bundling part,
however, I am unfamiliar with.

Regarding the high consumption of energy, I think, having read thread, I
think everyone would agree
that a warning in the description would be beneficial.

Finally, since I submitted the patch, I discovered that xmrig, in it's
default state, will donate 1% of it's runtime to the developpers' pool.
I don't know what is guix's policy on this matter, but I will assume we
want it disabled.

I'm going to fix the issues raised and send an updated patch.

Cheers,
Justin.
J
J
Justin Veilleux wrote on 6 Apr 02:51 +0200
(name . Ludovic Courtès)(address . ludo@gnu.org)
208f943c-cc6c-a2c6-5a52-81a9f466831a@cock.li
This is the updated patch for xmrig, but I still have to figure out how
to package some of p2pool's c++ dependencies.

Cheers.
From a8003036d713228d0f24324992d296161ac3187b Mon Sep 17 00:00:00 2001
From: terramorpha <terramorpha@cock.li>
Date: Tue, 5 Apr 2022 20:46:35 -0400
Subject: [PATCH] gnu: Add xmrig.

* gnu/packages/finance.scm (xmrig): New variable.
---
gnu/packages/finance.scm | 50 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)

Toggle diff (74 lines)
diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm
index 9f2d055048..953e6dd075 100644
--- a/gnu/packages/finance.scm
+++ b/gnu/packages/finance.scm
@@ -26,6 +26,7 @@
 ;;; Copyright © 2021 François J <francois-oss@avalenn.eu>
 ;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com>
 ;;; Copyright © 2021 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2022 Justin Veilleux <terramorpha@cock.li>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -93,6 +94,7 @@ (define-module (gnu packages finance)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages man)
   #:use-module (gnu packages maths)
+  #:use-module (gnu packages mpi)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages networking)
@@ -1978,3 +1980,51 @@ (define-public python-mt-940
 format used by SWIFT.  It returns smart Python collections for statistics
 and manipulation.")
     (license license:bsd-3)))
+
+(define-public xmrig
+  (package
+   (name "xmrig")
+    (version "6.16.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/xmrig/xmrig")
+         (commit (string-append "v" version))))
+       (sha256 (base32 "0mp7q14pfbdjvjai6nw6psqakr1hnzkkn4c51iw578866n2lmxw5"))))
+    (build-system cmake-build-system)
+    (inputs
+     (list
+      `(,hwloc "lib")
+      libuv
+      openssl))
+    (arguments
+     (list
+      ;; There are no tests.
+      #:tests? #f
+      #:modules '((guix build utils)
+                  (guix build cmake-build-system))
+      #:phases
+      #~(modify-phases
+         %standard-phases
+         (add-before 'configure 'disable-default-donation
+                     (lambda* (#:key outputs #:allow-other-keys)
+                       (substitute* "src/donate.h"
+                         (("constexpr const int kDefaultDonateLevel = 1;")
+                          "constexpr const int kDefaultDonateLevel = 0;")
+                         (("constexpr const int kMinimumDonateLevel = 1;")
+                          "constexpr const int kMinimumDonateLevel = 0;"))))
+         (replace 'install
+                  ;; There is no 'install' target, we must install xmrig manually
+                  (lambda* (#:key #:allow-other-keys)
+                    (install-file "xmrig"
+                                  (string-append #$output "/bin")))))))
+    (home-page "https://xmrig.com/")
+    (synopsis "Monero miner")
+    (description
+     "XMRig is a high performance, open source, cross platform RandomX, KawPow,
+CryptoNight, AstroBWT and GhostRider unified CPU/GPU miner and RandomX
+benchmark. Warning: This software, because of it's nature, has high energy
+consumption.")
+    (license license:gpl3+)))
-- 
2.34.0
M
M
Maxime Devos wrote on 6 Apr 12:29 +0200
(address . 54068@debbugs.gnu.org)
f24fe989708ef6c10ad0d59f5db6097b2190b6d5.camel@telenet.be
Justin Veilleux schreef op di 05-04-2022 om 14:57 [-0400]:
Toggle quote (5 lines)
> Finally, since I submitted the patch, I discovered that xmrig, in it's
> default state, will donate 1% of it's runtime to the developpers' pool.
> I don't know what is guix's policy on this matter, but I will assume we
> want it disabled.

IMO, involuntary donations are not donations, but theft. Or possibly
taxes, but the xmrig developers are not a state (and if they were, you
might not even be part of that state), so not that either.

Maybe as a warning (to people that might install xmrig on non-guix
systems or without a package manager) you could add something like

Warning: upstream always confiscates a percentage of the results. 
This anti-functionality has been neutralised in Guix, but possibly
not in all other distributions.

and move 'disable-default-donation' to a snippet such that
"guix build --source xmrig" returns a ‘safe’ xmrig.

and maybe

Warning: This software, because of it's nature, has high energy
consumption, so by using it, you accelerate global warming. 
Additionally, the energy expenses might be more than the
cryptocurrency gained by mining.

Greetings
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYk1rmxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7jFLAQDwFiDqEW53Hu/bewPYgxfdKrNj
eldcxjhEMYhGlIHdFgD9E0NPlQQi1L49Kv5lv/kmfRwpk38nCVJlHqweeAJ6DQw=
=Vhqg
-----END PGP SIGNATURE-----


J
J
Justin Veilleux wrote on 6 Apr 17:33 +0200
(address . 54068@debbugs.gnu.org)
5effc6fe-1f61-3a97-5185-919b340bf287@cock.li
Hi, I moved the neutralisation of donation to the source's snippet and
updated the description to reflect the cost of using xmrig.


Cheers, Justin.
From 42c0c7001dcc31813ebbfe21e2afc19c99f7309b Mon Sep 17 00:00:00 2001
From: terramorpha <terramorpha@cock.li>
Date: Tue, 5 Apr 2022 20:46:35 -0400
Subject: [PATCH] gnu: Add xmrig.

* gnu/packages/finance.scm (xmrig): New variable.
---
gnu/packages/finance.scm | 59 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)

Toggle diff (83 lines)
diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm
index 9f2d055048..4cb3075c6f 100644
--- a/gnu/packages/finance.scm
+++ b/gnu/packages/finance.scm
@@ -26,6 +26,7 @@
 ;;; Copyright © 2021 François J <francois-oss@avalenn.eu>
 ;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com>
 ;;; Copyright © 2021 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2022 Justin Veilleux <terramorpha@cock.li>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -93,6 +94,7 @@ (define-module (gnu packages finance)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages man)
   #:use-module (gnu packages maths)
+  #:use-module (gnu packages mpi)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages networking)
@@ -1978,3 +1980,60 @@ (define-public python-mt-940
 format used by SWIFT.  It returns smart Python collections for statistics
 and manipulation.")
     (license license:bsd-3)))
+
+(define-public xmrig
+  (package
+   (name "xmrig")
+    (version "6.16.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/xmrig/xmrig")
+         (commit (string-append "v" version))))
+       (sha256 (base32 "0mp7q14pfbdjvjai6nw6psqakr1hnzkkn4c51iw578866n2lmxw5"))
+       (snippet
+        (with-imported-modules '((guix build utils))
+          #~(begin
+              (use-modules (guix build utils))
+              (substitute* "src/donate.h"
+                (("constexpr const int kDefaultDonateLevel = 1;")
+                 "constexpr const int kDefaultDonateLevel = 0;")
+                (("constexpr const int kMinimumDonateLevel = 1;")
+                 "constexpr const int kMinimumDonateLevel = 0;")))))))
+    (build-system cmake-build-system)
+    (inputs
+     (list
+      `(,hwloc "lib")
+      libuv
+      openssl))
+    (arguments
+     (list
+      ;; There are no tests.
+      #:tests? #f
+      #:modules '((guix build utils)
+                  (guix build cmake-build-system))
+      #:phases
+      #~(modify-phases
+         %standard-phases
+         (replace 'install
+                  ;; There is no 'install' target, we must install xmrig manually
+                  (lambda* (#:key #:allow-other-keys)
+                    (install-file "xmrig"
+                                  (string-append #$output "/bin")))))))
+    (home-page "https://xmrig.com/")
+    (synopsis "Monero miner")
+    (description
+     "XMRig is a high performance, open source, cross platform RandomX, KawPow,
+CryptoNight, AstroBWT and GhostRider unified CPU/GPU miner and RandomX
+benchmark.
+
+Warning: upstream, by default, receives a percentage of the mining time. This
+anti-functionality has been neutralised in Guix, but possibly not in all other
+distributions.
+
+Warning: This software, because of it's nature, has high energy consumption
+and will increase your carbon footprint. Also, the energy expenses might be
+higher that the cryptocurrency gained by mining.")
+    (license license:gpl3+)))
-- 
2.34.0
M
M
Maxime Devos wrote on 6 Apr 20:24 +0200
(address . 54068@debbugs.gnu.org)
172ba8211c961d060cb98166f9ff8fe6062b7ea9.camel@telenet.be
Justin Veilleux schreef op wo 06-04-2022 om 11:33 [-0400]:
Toggle quote (11 lines)
> +       (snippet
> +        (with-imported-modules '((guix build utils))
> +          #~(begin
> +              (use-modules (guix build utils))
> +              (substitute* "src/donate.h"
> +                (("constexpr const int kDefaultDonateLevel = 1;")
> +                 "constexpr const int kDefaultDonateLevel = 0;")
> +                (("constexpr const int kMinimumDonateLevel = 1;")
> +                 "constexpr const int kMinimumDonateLevel =
> 0;")))))))

This can be done a bit simpler:

(origin [...]
(modules '((guix build utils)))
(snippet #~(substitute* "src/donate.h" [...])))

not 100% sure if that works ...

Greetings,
Maxime.

p.s. Do you know any other distros packaging xmrig & p2pool? Maybe
they can be informed as well ...
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYk3a7xccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7jfZAQCkwo6+gTCodhNzQQkHCMFfZAps
H5+fz1ZyjQoZ070bFQD7B1T7FJoMyBntsVmAQq3Os0/EROUCE8ULSdSWhnplkQ0=
=nO0y
-----END PGP SIGNATURE-----


J
J
Justin Veilleux wrote on 6 Apr 21:46 +0200
(address . 54068@debbugs.gnu.org)
fd7a683c-7367-ce14-8f81-df165e119b3d@cock.li
You are right, this is simpler

Regarding the other distros and the automatic/minimum donation, I found
that most major distributions*
patch out the minimum donation level(but keep the default of 1%) and few
leave it unchanged.

From 0851821735fef3df3e1792644a8544af79a45e0f Mon Sep 17 00:00:00 2001
From: terramorpha <terramorpha@cock.li>
Date: Tue, 5 Apr 2022 20:46:35 -0400
Subject: [PATCH] gnu: Add xmrig.

* gnu/packages/finance.scm (xmrig): New variable.
---
gnu/packages/finance.scm | 57 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)

Toggle diff (81 lines)
diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm
index 9f2d055048..87727b987a 100644
--- a/gnu/packages/finance.scm
+++ b/gnu/packages/finance.scm
@@ -26,6 +26,7 @@
 ;;; Copyright © 2021 François J <francois-oss@avalenn.eu>
 ;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com>
 ;;; Copyright © 2021 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2022 Justin Veilleux <terramorpha@cock.li>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -93,6 +94,7 @@ (define-module (gnu packages finance)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages man)
   #:use-module (gnu packages maths)
+  #:use-module (gnu packages mpi)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages networking)
@@ -1978,3 +1980,58 @@ (define-public python-mt-940
 format used by SWIFT.  It returns smart Python collections for statistics
 and manipulation.")
     (license license:bsd-3)))
+
+(define-public xmrig
+  (package
+   (name "xmrig")
+    (version "6.17.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/xmrig/xmrig")
+         (commit (string-append "v" version))))
+       (sha256 (base32 "11wh2ry3dnjynzc9a3nd8mfja7h6nxmx4fwaha82ssz5dkfqvj9b"))
+       (modules '((guix build utils)))
+       (snippet
+        #~(substitute* "src/donate.h"
+            (("constexpr const int kDefaultDonateLevel = 1;")
+             "constexpr const int kDefaultDonateLevel = 0;")
+            (("constexpr const int kMinimumDonateLevel = 1;")
+             "constexpr const int kMinimumDonateLevel = 0;")))))
+    (build-system cmake-build-system)
+    (inputs
+     (list
+      `(,hwloc "lib")
+      libuv
+      openssl))
+    (arguments
+     (list
+      ;; There are no tests.
+      #:tests? #f
+      #:modules '((guix build utils)
+                  (guix build cmake-build-system))
+      #:phases
+      #~(modify-phases
+         %standard-phases
+         (replace 'install
+                  ;; There is no 'install' target, we must install xmrig manually
+                  (lambda* (#:key #:allow-other-keys)
+                    (install-file "xmrig"
+                                  (string-append #$output "/bin")))))))
+    (home-page "https://xmrig.com/")
+    (synopsis "Monero miner")
+    (description
+     "XMRig is a high performance, open source, cross platform RandomX, KawPow,
+CryptoNight, AstroBWT and GhostRider unified CPU/GPU miner and RandomX
+benchmark.
+
+Warning: upstream, by default, receives a percentage of the mining time. This
+anti-functionality has been neutralised in Guix, but possibly not in all other
+distributions.
+
+Warning: This software, because of it's nature, has high energy consumption
+and will increase your carbon footprint. Also, the energy expenses might be
+higher that the cryptocurrency gained by mining.")
+    (license license:gpl3+)))
-- 
2.34.0
J
J
Justin Veilleux wrote on 6 Apr 21:53 +0200
(address . 54068@debbugs.gnu.org)
67812782-67d5-2936-1482-1afa7da455b3@cock.li
Also, I forgot...

P2pool does not have this behaviour. In fact, xmrig and p2pool are only
related insofar as one needs the former to use the latter.

I have not yet managed to extract the bundled dependencies of p2pool as
explicit inputs. In particular, robin-hood-hashing is a c++ library
which doesn't have a package structure and can't be `install`ed.


Cheers.
?