diff mbox series

[bug#36410] gnu: Add screenfetch.

Message ID 8736ju8rrt.fsf@sdf.lonestar.org
State Accepted
Headers show
Series [bug#36410] gnu: Add screenfetch. | expand

Commit Message

Jakob L. Kreuze June 28, 2019, 12:42 a.m. UTC
* gnu/packages/admin.scm (screenfetch): New variable.
---
 gnu/packages/admin.scm | 47 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

Comments

swedebugia June 28, 2019, 5:15 a.m. UTC | #1
On 2019-06-28 02:42, Jakob L. Kreuze wrote:
> * gnu/packages/admin.scm (screenfetch): New variable.
> ---
>   gnu/packages/admin.scm | 47 ++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 47 insertions(+)
> 
> diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
> index 3d8c247f57..b920d564e5 100644
> --- a/gnu/packages/admin.scm
> +++ b/gnu/packages/admin.scm
> @@ -25,6 +25,7 @@
>   ;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
>   ;;; Copyright © 2019 Brett Gilio <brettg@posteo.net>
>   ;;; Copyright © 2019 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
> +;;; Copyright © 2019 Jakob L. Kreuze <zerodaysfordays@sdf.lonestar.org>
>   ;;;
>   ;;; This file is part of GNU Guix.
>   ;;;
> @@ -55,6 +56,7 @@
>     #:use-module (guix build-system python)
>     #:use-module (guix build-system trivial)
>     #:use-module (gnu packages)
> +  #:use-module (gnu packages algebra)
>     #:use-module (gnu packages base)
>     #:use-module (gnu packages bash)
>     #:use-module (gnu packages check)
> @@ -2651,6 +2653,51 @@ used in screenshots to show other users what operating system or distribution
>   you are running, what theme or icon set you are using, etc.")
>       (license license:expat)))
>   
> +(define-public screenfetch
> +  ;; first commit supporting current GuixSD
> +  (let ((commit "e3ec82dd464e81e4d10bef218b3016e3044c766c"))
> +    (package
> +      (name "screenfetch")
> +      (version (string-append "3.8.0" "-" (string-take commit 7)))
> +      (source (origin
> +                (method git-fetch)
> +                (uri (git-reference
> +                      (url "https://github.com/KittyKatt/screenFetch")
> +                      (commit commit)))
> +                (file-name (git-file-name name version))
> +                (sha256
> +                 (base32
> +                  "1lzs1l5xgj9mn4b59lhkfgqnyiivf8svd1iwjabzrax90rdmxfwj"))))
> +      (build-system trivial-build-system)
> +      (arguments
> +       `(#:modules ((guix build utils))
> +         #:builder
> +         (begin
> +           (use-modules (guix build utils))
> +           (let ((source (assoc-ref %build-inputs "source")))
> +             (mkdir-p (string-append %output "/bin/"))
> +             (mkdir-p (string-append %output "/man/man1/"))
> +             (copy-file (string-append source "/screenfetch-dev")
> +                        (string-append %output "/bin/screenfetch"))
> +             (copy-file (string-append source "/screenfetch.1")
> +                        (string-append %output "/man/man1/screenfetch.1"))
> +             (substitute* (string-append %output "/bin/screenfetch")
> +               (("/usr/bin/env bash")
> +                (string-append (assoc-ref %build-inputs "bash")
> +                               "/bin/bash")))))))
> +      (propagated-inputs
> +       `(("bash" ,bash)
> +         ("bc" ,bc)
> +         ("scrot" ,scrot)
> +         ("xdpyinfo" ,xdpyinfo)
> +         ("xprop" ,xprop)))
> +      (home-page "https://github.com/KittyKatt/screenFetch")
> +      (synopsis "System information script")
> +      (description "Bash screenshot information tool which can be used to
> +generate those nifty terminal theme information and ASCII distribution logos in
> +everyone's screenshots nowadays.")
> +      (license license:gpl3))))

gpl3+

Could you ask upstream to release a version we can track?

Otherwise LGTM.
Jakob L. Kreuze June 28, 2019, 2 p.m. UTC | #2
swedebugia <swedebugia@riseup.net> writes:

> gpl3+

Thanks, missed that.

> Could you ask upstream to release a version we can track?

Will do. The last release was over two years ago, so I think v3.9.0 is
well overdue :]
Efraim Flashner July 2, 2019, 7:18 a.m. UTC | #3
On Thu, Jun 27, 2019 at 08:42:14PM -0400, Jakob L. Kreuze wrote:
> * gnu/packages/admin.scm (screenfetch): New variable.
> ---
>  gnu/packages/admin.scm | 47 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 47 insertions(+)
> 
> diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
> index 3d8c247f57..b920d564e5 100644
> --- a/gnu/packages/admin.scm
> +++ b/gnu/packages/admin.scm
> @@ -25,6 +25,7 @@
>  ;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
>  ;;; Copyright © 2019 Brett Gilio <brettg@posteo.net>
>  ;;; Copyright © 2019 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
> +;;; Copyright © 2019 Jakob L. Kreuze <zerodaysfordays@sdf.lonestar.org>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -55,6 +56,7 @@
>    #:use-module (guix build-system python)
>    #:use-module (guix build-system trivial)
>    #:use-module (gnu packages)
> +  #:use-module (gnu packages algebra)
>    #:use-module (gnu packages base)
>    #:use-module (gnu packages bash)
>    #:use-module (gnu packages check)
> @@ -2651,6 +2653,51 @@ used in screenshots to show other users what operating system or distribution
>  you are running, what theme or icon set you are using, etc.")
>      (license license:expat)))
>  
> +(define-public screenfetch
> +  ;; first commit supporting current GuixSD
> +  (let ((commit "e3ec82dd464e81e4d10bef218b3016e3044c766c"))
> +    (package
> +      (name "screenfetch")
> +      (version (string-append "3.8.0" "-" (string-take commit 7)))
> +      (source (origin
> +                (method git-fetch)
> +                (uri (git-reference
> +                      (url "https://github.com/KittyKatt/screenFetch")
> +                      (commit commit)))
> +                (file-name (git-file-name name version))
> +                (sha256
> +                 (base32
> +                  "1lzs1l5xgj9mn4b59lhkfgqnyiivf8svd1iwjabzrax90rdmxfwj"))))
> +      (build-system trivial-build-system)
> +      (arguments
> +       `(#:modules ((guix build utils))
> +         #:builder
> +         (begin
> +           (use-modules (guix build utils))
> +           (let ((source (assoc-ref %build-inputs "source")))
> +             (mkdir-p (string-append %output "/bin/"))
> +             (mkdir-p (string-append %output "/man/man1/"))
> +             (copy-file (string-append source "/screenfetch-dev")
> +                        (string-append %output "/bin/screenfetch"))
> +             (copy-file (string-append source "/screenfetch.1")
> +                        (string-append %output "/man/man1/screenfetch.1"))

If 'install-file' works here then the above 6 lines can be 2, something
like:
(install-file (string-append source "/screenfetch.1")
              (string-append %output "/man/man1/"))

> +             (substitute* (string-append %output "/bin/screenfetch")
> +               (("/usr/bin/env bash")
> +                (string-append (assoc-ref %build-inputs "bash")
> +                               "/bin/bash")))))))

you can use the patch-shebang function here, should help a bit.

> +      (propagated-inputs
> +       `(("bash" ,bash)
> +         ("bc" ,bc)
> +         ("scrot" ,scrot)
> +         ("xdpyinfo" ,xdpyinfo)
> +         ("xprop" ,xprop)))

Ideally these should wrap the binary rather than being propagated.

> +      (home-page "https://github.com/KittyKatt/screenFetch")
> +      (synopsis "System information script")
> +      (description "Bash screenshot information tool which can be used to
> +generate those nifty terminal theme information and ASCII distribution logos in
> +everyone's screenshots nowadays.")
> +      (license license:gpl3))))
> +
>  (define-public nnn
>    (package
>      (name "nnn")
> -- 
> 2.22.0
>
Jakob L. Kreuze July 2, 2019, 4:07 p.m. UTC | #4
Hi Efraim,

Efraim Flashner <efraim@flashner.co.il> writes:

> If 'install-file' works here then the above 6 lines can be 2, something
> like:
> (install-file (string-append source "/screenfetch.1")
>               (string-append %output "/man/man1/"))

That's certainly much clearer. Would it make sense to do the same for
'screenfetch-dev', renaming the file after copying it with
'install-file'? Or, should a '#:rename' keyword be added to
'install-file', perhaps? I don't know if it would be a useful pattern or
not, but it's an easy addition and I'd be happy to submit a separate
patch if there's any interest.

> you can use the patch-shebang function here, should help a bit.

Thanks, that seems to be just one of many hidden gems in '(guix build
utils)'. I should really skim through that whole file at some point,
these procedures would definitely make packaging much easier.

> Ideally these should wrap the binary rather than being propagated.

I'm a bit unsure as to what you mean. Should I patch the screenfetch
script to use absolute paths for the binaries of these inputs? I.e.
patch 'bc' to '/gnu/store/...-bc-1.07.1/bin/bc'?

Regards,
Jakob
Efraim Flashner Sept. 5, 2019, 12:06 p.m. UTC | #5
I'm sorry, this one fell through the cracks and I forgot about it.

On Tue, Jul 02, 2019 at 12:07:31PM -0400, Jakob L. Kreuze wrote:
> Hi Efraim,
> 
> Efraim Flashner <efraim@flashner.co.il> writes:
> 
> > If 'install-file' works here then the above 6 lines can be 2, something
> > like:
> > (install-file (string-append source "/screenfetch.1")
> >               (string-append %output "/man/man1/"))
> 
> That's certainly much clearer. Would it make sense to do the same for
> 'screenfetch-dev', renaming the file after copying it with
> 'install-file'? Or, should a '#:rename' keyword be added to
> 'install-file', perhaps? I don't know if it would be a useful pattern or
> not, but it's an easy addition and I'd be happy to submit a separate
> patch if there's any interest.
> 

I think since we want to rename it anyway I wouldn't bother with
'install-file' for screenfetch-dev.

> > you can use the patch-shebang function here, should help a bit.
> 
> Thanks, that seems to be just one of many hidden gems in '(guix build
> utils)'. I should really skim through that whole file at some point,
> these procedures would definitely make packaging much easier.
> 
> > Ideally these should wrap the binary rather than being propagated.
> 
> I'm a bit unsure as to what you mean. Should I patch the screenfetch
> script to use absolute paths for the binaries of these inputs? I.e.
> patch 'bc' to '/gnu/store/...-bc-1.07.1/bin/bc'?

I found an example of what I was thinking of in (gnu packages
dictionaries), with translate-shell. The function itself is called
'wrap-program'.

Can you send an updated patch?

thanks
Efraim Flashner Sept. 23, 2019, 4:08 p.m. UTC | #6
Pushed with some changes

 +                                    ?  efraim@E5400
 ??                                  ?I  OS: GuixSD
  ??I?   I??N              ???    ????   Kernel: x86_64 Linux 5.2.13-gnu
   ?III7???????          ??????7III?Z    Uptime: 1d 8h 40m
     OI77$?????         ?????7IIII       Packages: 12629
           ?????        ????             Shell: bash 4.4.23
            ???ID      ????              Disk: 44G / 110G (41%)
             IIII     +????              CPU: Pentium Dual-Core E5400 @ 2x 1.318GHz
             IIIII    ????               GPU: Intel Corporation 4 Series Chipset Integrated Graphics Controller (rev 03)
              IIII   ?????               RAM: 483MiB / 1959MiB
              IIIII  ????
               II77 ????$
               7777+????
                77++???$
                N?+????
Jakob L. Kreuze Sept. 28, 2019, 8:48 p.m. UTC | #7
Efraim Flashner <efraim@flashner.co.il> writes:

> Pushed with some changes
>
>  +                                    ?  efraim@E5400
>  ??                                  ?I  OS: GuixSD
>   ??I?   I??N              ???    ????   Kernel: x86_64 Linux 5.2.13-gnu
>    ?III7???????          ??????7III?Z    Uptime: 1d 8h 40m
>      OI77$?????         ?????7IIII       Packages: 12629
>            ?????        ????             Shell: bash 4.4.23
>             ???ID      ????              Disk: 44G / 110G (41%)
>              IIII     +????              CPU: Pentium Dual-Core E5400 @ 2x 1.318GHz
>              IIIII    ????               GPU: Intel Corporation 4 Series Chipset Integrated Graphics Controller (rev 03)
>               IIII   ?????               RAM: 483MiB / 1959MiB
>               IIIII  ????
>                II77 ????$
>                7777+????
>                 77++???$
>                 N?+????

Heh, guess this one spent a little too long on my backlog. Thanks for
taking care of that!

Regards,
Jakob
Jakob L. Kreuze Oct. 5, 2019, 8:19 a.m. UTC | #8
Efraim Flashner <efraim@flashner.co.il> writes:

> Pushed with some changes
>
>  +                                    ?  efraim@E5400
>  ??                                  ?I  OS: GuixSD
>   ??I?   I??N              ???    ????   Kernel: x86_64 Linux 5.2.13-gnu
>    ?III7???????          ??????7III?Z    Uptime: 1d 8h 40m
>      OI77$?????         ?????7IIII       Packages: 12629
>            ?????        ????             Shell: bash 4.4.23
>             ???ID      ????              Disk: 44G / 110G (41%)
>              IIII     +????              CPU: Pentium Dual-Core E5400 @ 2x 1.318GHz
>              IIIII    ????               GPU: Intel Corporation 4 Series Chipset Integrated Graphics Controller (rev 03)
>               IIII   ?????               RAM: 483MiB / 1959MiB
>               IIIII  ????
>                II77 ????$
>                7777+????
>                 77++???$
>                 N?+????

Just an FYI that we've finally got a release [1] tagged with proper
GuixSD support.

[1]: https://github.com/KittyKatt/screenFetch/releases/tag/v3.9.0
diff mbox series

Patch

diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 3d8c247f57..b920d564e5 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -25,6 +25,7 @@ 
 ;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
 ;;; Copyright © 2019 Brett Gilio <brettg@posteo.net>
 ;;; Copyright © 2019 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
+;;; Copyright © 2019 Jakob L. Kreuze <zerodaysfordays@sdf.lonestar.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -55,6 +56,7 @@ 
   #:use-module (guix build-system python)
   #:use-module (guix build-system trivial)
   #:use-module (gnu packages)
+  #:use-module (gnu packages algebra)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages check)
@@ -2651,6 +2653,51 @@  used in screenshots to show other users what operating system or distribution
 you are running, what theme or icon set you are using, etc.")
     (license license:expat)))
 
+(define-public screenfetch
+  ;; first commit supporting current GuixSD
+  (let ((commit "e3ec82dd464e81e4d10bef218b3016e3044c766c"))
+    (package
+      (name "screenfetch")
+      (version (string-append "3.8.0" "-" (string-take commit 7)))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/KittyKatt/screenFetch")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "1lzs1l5xgj9mn4b59lhkfgqnyiivf8svd1iwjabzrax90rdmxfwj"))))
+      (build-system trivial-build-system)
+      (arguments
+       `(#:modules ((guix build utils))
+         #:builder
+         (begin
+           (use-modules (guix build utils))
+           (let ((source (assoc-ref %build-inputs "source")))
+             (mkdir-p (string-append %output "/bin/"))
+             (mkdir-p (string-append %output "/man/man1/"))
+             (copy-file (string-append source "/screenfetch-dev")
+                        (string-append %output "/bin/screenfetch"))
+             (copy-file (string-append source "/screenfetch.1")
+                        (string-append %output "/man/man1/screenfetch.1"))
+             (substitute* (string-append %output "/bin/screenfetch")
+               (("/usr/bin/env bash")
+                (string-append (assoc-ref %build-inputs "bash")
+                               "/bin/bash")))))))
+      (propagated-inputs
+       `(("bash" ,bash)
+         ("bc" ,bc)
+         ("scrot" ,scrot)
+         ("xdpyinfo" ,xdpyinfo)
+         ("xprop" ,xprop)))
+      (home-page "https://github.com/KittyKatt/screenFetch")
+      (synopsis "System information script")
+      (description "Bash screenshot information tool which can be used to
+generate those nifty terminal theme information and ASCII distribution logos in
+everyone's screenshots nowadays.")
+      (license license:gpl3))))
+
 (define-public nnn
   (package
     (name "nnn")