summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2021-12-21 22:20:23 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2021-12-21 22:20:23 +0100
commitf7493e1dc8e6d4e483eff9e80bdb05301582f045 (patch)
tree1ed4dc4bed17091d48040b94057eb6ccbd4d8aba /gnu
parent081c07d6a084481c34b5bc8b145feecc7d7379db (diff)
downloadguix-f7493e1dc8e6d4e483eff9e80bdb05301582f045.tar.gz
gnu: Add tlpui.
* gnu/packages/linux.scm (tlpui): New variable.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/linux.scm64
1 files changed, 64 insertions, 0 deletions
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 67320a1e60..7e6f0c7010 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -6926,6 +6926,70 @@ every time the power supply source is changed.")
     ;; rest is GPLv2+.
     (license (list license:gpl2+ license:gpl3+))))
 
+(define-public tlpui
+  (package
+    (name "tlpui")
+    (version "1.4.0-1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/d4nj1/TLPUI")
+             (commit (string-append "tlpui-" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0yshdpj521wiwc5rkvq89hwq9f3nqp3jbz8v921hpyk8wwq7nniq"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-setup.py
+           ;; Install data_files to $out/share instead of /usr/share.
+           (lambda _
+             (substitute* "setup.py"
+               (("/usr/") ""))))
+         (add-after 'unpack 'use-tlp-input
+           ;; Hard-code tlp-stat filename to avoid propagating "tlp".
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((tlp-stat (search-input-file inputs "/bin/tlp-stat")))
+               (with-directory-excursion "tlpui"
+                 (substitute* '("file.py" "settingshelper.py" "statui.py")
+                   (("which\\(\"tlp-stat\"\\)")
+                    (string-append "'" tlp-stat "'"))
+                   (("\"tlp-stat\"")
+                    (string-append "'" tlp-stat "'")))))))
+         (add-before 'check 'fix-home-directory
+           (lambda _
+             ;; Tests fail with "Permission denied:
+             ;; '/homeless-shelter'".
+             (setenv "HOME" "/tmp")))
+         ;; `sanity-check' phase errors out with the following
+         ;; messages: "Unable to init server: Could not connect:
+         ;; Connection refused" and "Error: cannot read user
+         ;; configuration from /etc/tlp.conf or /etc/default/tlp".
+         (delete 'sanity-check)
+         (replace 'check
+           (lambda _
+             (invoke "python" "-m" "discover")))
+         (add-after 'install 'wrap-gi-python
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out"))
+                   (gi-typelib-path (getenv "GI_TYPELIB_PATH")))
+               (wrap-program (string-append out "/bin/tlpui")
+                 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path)))))))))
+    (native-inputs
+     (list `(,glib "bin") gobject-introspection python-discover))
+    (inputs
+     (list gtk+ python-pygobject tlp))
+    (home-page "https://github.com/d4nj1/TLPUI")
+    (synopsis "User interface for TLP written in Python")
+    (description
+     "The Python scripts in this project generate a GTK-UI to change
+TLP configuration files easily.  It aims to protect users from setting
+bad configuration and to deliver a basic overview of all the valid
+configuration values.")
+    (license license:gpl2+)))
+
 (define-public lshw
   (package
     (name "lshw")