diff mbox series

[bug#54068] Add xmrig and p2pool

Message ID 356b1509-0df9-6579-d440-95bc74c9f2e3@cock.li
State Accepted
Headers show
Series [bug#54068] Add xmrig and p2pool | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Justin Veilleux Feb. 19, 2022, 11:12 p.m. UTC
Here are two patches to add, respectively, the xmrig monero mining 
software and p2pool, a decentralized mining pool.

Cheers

Comments

M Feb. 20, 2022, 10:14 a.m. UTC | #1
Justin Veilleux schreef op za 19-02-2022 om 18:12 [-0500]:
> +      #~(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).

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

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

> +              #t)))))

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

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

I think ‘Monero miner’ would be more descriptive.

> +    (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.)

> +    (license license:gpl3)))

Looking at
<https://github.com/xmrig/xmrig/blob/master/src/App_win.cpp>, it
appears to be gpl3+.

Greetings,
Maxime.
M Feb. 20, 2022, 10:17 a.m. UTC | #2
Justin Veilleux schreef op za 19-02-2022 om 18:12 [-0500]:
> +    (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.
Ludovic Courtès April 5, 2022, 2:05 p.m. UTC | #3
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.

  https://issues.guix.gnu.org/54068

TIA,
Ludo’.
Justin Veilleux April 5, 2022, 6:57 p.m. UTC | #4
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.
M April 6, 2022, 10:29 a.m. UTC | #5
Justin Veilleux schreef op di 05-04-2022 om 14:57 [-0400]:
> 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.
diff mbox series

Patch

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(+)

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