Subject: [bug#31176] [PATCH] gnu: Add inxi.

From: Oleg Pykhalov <[email-masked]>
Date: Mon, 16 Apr 2018 13:22:31 +0300

* gnu/packages/inxi.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add this.
---
 gnu/local.mk          |   1 +
 gnu/packages/inxi.scm | 116 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 117 insertions(+)
 create mode 100644 gnu/packages/inxi.scm

diff --git a/gnu/local.mk b/gnu/local.mk
index 713d9ae11..1c0c3d16c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -228,6 +228,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/indent.scm			\
   %D%/packages/inklingreader.scm		\
   %D%/packages/inkscape.scm			\
+  %D%/packages/inxi.scm			\
   %D%/packages/irc.scm  			\
   %D%/packages/iso-codes.scm			\
   %D%/packages/java.scm				\
diff --git a/gnu/packages/inxi.scm b/gnu/packages/inxi.scm
new file mode 100644
index 000000000..ada2ce216
--- /dev/null
+++ b/gnu/packages/inxi.scm
@@ -0,0 +1,116 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2018 Oleg Pykhalov <[email-masked]>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages inxi)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages admin)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages bash)
+  #:use-module (gnu packages compression)
+  #:use-module (gnu packages file)
+  #:use-module (gnu packages gawk)
+  #:use-module (gnu packages gl)
+  #:use-module (gnu packages linux)
+  #:use-module (gnu packages pciutils)
+  #:use-module (gnu packages xorg)
+  #:use-module (gnu packages)
+  #:use-module (guix build-system trivial)
+  #:use-module (guix download)
+  #:use-module (guix git-download)
+  #:use-module (guix packages)
+  #:use-module (ice-9 match))
+
+(define-public inxi-minimal
+  (let ((commit "c934578ffb4f920cb04c91305a54dbdc4aa99d80"))
+    (package
+      (name "inxi-minimal")
+      (version (git-version "2.3.56" "1" commit))
+      (source
+       (origin
+         (method url-fetch)
+         (uri (string-append "https://github.com/smxi/inxi"
+                             "/raw/" commit "/inxi.tar.gz"))
+         (file-name (string-append name "-" version ".tar.gz"))
+         (sha256
+          (base32
+           "0cmb95fw4jf5fqxmivwxy63sqyl7jnb3v7sbqqhafx0iwxgxi77h"))))
+      (build-system trivial-build-system)
+      (inputs
+       `(("bash" ,bash)))
+      (native-inputs
+       `(("coreutils" ,coreutils)
+         ("gawk" ,gawk)
+         ("grep" ,grep)
+         ("pciutils" ,pciutils)
+         ("procps" ,procps)
+         ("sed" ,sed)
+         ("tar" ,tar)
+         ("gzip" ,gzip)))
+      (arguments
+       `(#:modules
+         ((guix build utils)
+          (ice-9 match))
+         #:builder
+         (begin
+           (use-modules (guix build utils)
+                        (ice-9 match))
+           (setenv "PATH" (string-append
+                           (assoc-ref %build-inputs "tar") "/bin" ":"
+                           (assoc-ref %build-inputs "gzip") "/bin" ":"
+                           (assoc-ref %build-inputs "bash") "/bin"))
+           (system* "tar" "xvf" (assoc-ref %build-inputs "source"))
+           (substitute* "inxi" (("/usr/bin/env bash") (which "bash")))
+           (let ((bin (string-append %output "/bin")))
+             (install-file "inxi" bin)
+             (wrap-program (string-append bin "/inxi")
+               `("PATH" ":" = ("$PATH"
+                               ,@(map (lambda (input)
+                                        (string-append
+                                         (match input ((name . store) store))
+                                         "/bin"))
+                                      %build-inputs)))))
+           (install-file "inxi.1.gz"
+                         (string-append %output "/share/doc/man/man1"))
+           #t)))
+      (home-page "https://smxi.org/")
+      (synopsis "Full featured system information script")
+      (description "Inxi is a system information script that can display
+various things about your hardware and software to users in an IRC chatroom or
+support forum.  It runs with the /exec command in most IRC clients. ")
+      (license license:gpl3+))))
+
+(define-public inxi
+  (package
+    (inherit inxi-minimal)
+    (name "inxi")
+    (native-inputs
+     `(("dmidecode" ,dmidecode)
+       ("file" ,file)
+       ("iproute" ,iproute)
+       ("kmod" ,kmod)
+       ("lm-sensors" ,lm-sensors)
+       ("mesa-utils" ,mesa-utils)
+       ("net-tools" ,net-tools)
+       ("sudo" ,sudo)
+       ("usbutils" ,usbutils)
+       ("xdpyinfo" ,xdpyinfo)
+       ("xprop" ,xprop)
+       ("xrandr" ,xrandr)
+       ;; XXX: Add more inputs after packaging them.
+       ;; ("hddtemp" ,hddtemp)
+       ,@(package-native-inputs inxi-minimal)))))
-- 
2.17.0