diff mbox series

[bug#54068] Add xmrig and p2pool

Message ID 5effc6fe-1f61-3a97-5185-919b340bf287@cock.li
State Accepted
Headers show
Series [bug#54068] Add xmrig and p2pool | expand

Commit Message

Justin Veilleux April 6, 2022, 3:33 p.m. UTC
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.

Comments

M April 6, 2022, 6:24 p.m. UTC | #1
Justin Veilleux schreef op wo 06-04-2022 om 11:33 [-0400]:
> +       (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 ...
Justin Veilleux April 6, 2022, 7:53 p.m. UTC | #2
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.
Guillaume Le Vaillant Aug. 12, 2022, 3:45 p.m. UTC | #3
Hi Justin,

I rebased/modified/updated your patches, and pushed them as
ed4a3f17bf73d6a7e1d282924233498db79f7038 and
fc408acd61022d1db366bd1cec9ba1537773dfa1.
Thanks.
diff mbox series

Patch

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

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