~ruther/guix-local

f7493e1dc8e6d4e483eff9e80bdb05301582f045 — Nicolas Goaziou 4 years ago 081c07d
gnu: Add tlpui.

* gnu/packages/linux.scm (tlpui): New variable.
1 files changed, 64 insertions(+), 0 deletions(-)

M gnu/packages/linux.scm
M gnu/packages/linux.scm => gnu/packages/linux.scm +64 -0
@@ 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")