Subject: [PATCH 1/1] gnu: Add zenmonitor3 * gnu/package/linux.scm (zenmonitor3): New variable.

From: Steve George <[email-masked]>
Date: Tue, 24 Jan 2023 21:34:04 +0000

---

 gnu/packages/linux.scm | 49 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 250eacd076..2a590086ed 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -6694,6 +6694,55 @@ (define-public x86-energy-perf-policy
 cpufreq sub-system is enabled or not.")
     (license license:gpl2)))
 
+(define-public zenmonitor3
+  (package
+    (name "zenmonitor3")
+    (version "2e68a31b0248699ec1f3caa1782d9b520222242a")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://git.exozy.me/a/zenmonitor3")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "18rwk2jm2zjh15hdwqszyga2g7cyifblch0bska3drlm7ivqi2hx"))))
+    (build-system gnu-build-system)
+    (native-inputs (list pkg-config))
+    (inputs (list glib gtk+ gnu-make ncurses polkit-duktape))
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (delete 'configure)
+                  (add-after 'build 'build-cli
+                    (lambda* (#:key make-flags #:allow-other-keys)
+                      (apply invoke "make" "build-cli" make-flags)))
+                  (add-after 'install 'install-cli
+                    (lambda* (#:key make-flags #:allow-other-keys)
+                      (apply invoke
+                             `("make" "install-cli"
+                               ,@make-flags))))
+                  (add-after 'install-cli 'install-polkit
+                    (lambda* (#:key inputs outputs #:allow-other-keys)
+                      (let* ((out (assoc-ref outputs "out")))
+                        (mkdir-p (string-append out "/share/applications"))
+                        (install-file "data/zenmonitor-root.desktop.in"
+                                      (string-append out "/share/applications"))
+                        (mkdir-p (string-append out "/share/polkit-1/actions"))
+                        (install-file "data/org.pkexec.zenmonitor.policy.in"
+                                      (string-append out
+                                       "/share/polkit-1/actions"))))))
+       #:tests? #f
+       #:make-flags (list (string-append "CC="
+                                         ,(cc-for-target))
+                          (string-append "PREFIX=" %output))))
+    (home-page "https://git.exozy.me/a/zenmonitor3")
+    (synopsis "Monitoring software for AMD Zen-based CPUs")
+    (description
+     "Graphical and CLI monitoring of CPU temperature, voltage, power
+and frequency on AMD Zen family CPUs.  Requires the zenpower3 and MSR
+kernel drivers.")
+    (license license:expat)))
+
 (define-public haveged
   (package
     (name "haveged")
-- 
2.39.1