Subject: Re: [bug#67942] [PATCH] gnu: Add liquidprompt.

From: Ludovic Courtès <[email-masked]>
Date: Fri, 22 Dec 2023 17:38:06 +0100

Hello! :-)

Romain GARBAGE <[email-masked]> skribis:

> * gnu/packages/shellutils.scm (liquidprompt): New variable.
>
> Change-Id: I0004568df6dd6011f5e65c9894ce97a8c2533f84

Nice!  I took the liberty to make the changes below: license is AGPLv3+
because source code does not say otherwise, I change the direct
reference to ‘ncurses’ to an input + ‘search-input-file’ (that way,
users could inherit from the package, provided it a different
‘tput’-providing package, and it’d just work), and shrinked the
synopsis.

Thank you!

Ludo’.

diff --git a/gnu/packages/shellutils.scm b/gnu/packages/shellutils.scm
index 4288d5362a..f010a50538 100644
--- a/gnu/packages/shellutils.scm
+++ b/gnu/packages/shellutils.scm
@@ -828,9 +828,13 @@ (define-public liquidprompt
                                          #$output
                                          "/share/liquidprompt/liquidprompt")))))
 		   (add-after 'fix-plugin 'fix-tput-path
-		     (lambda _
+		     (lambda* (#:key inputs #:allow-other-keys)
 		       (substitute* "liquidprompt"
-			 (("([ (])tput " all beg) (string-append beg #$ncurses "/bin/tput "))))))))
+			 (("([ (])tput " all beginning)
+                          (string-append beginning
+                                         (search-input-file inputs "bin/tput")
+                                         " "))))))))
+    (inputs (list ncurses))
     (synopsis "Full-featured prompt for Bash & Zsh")
     (description
      "Liquidprompt is an adaptive prompt for Bash and Zsh that gives
@@ -838,18 +842,17 @@ (define-public liquidprompt
 does this with a powerful theming engine and a large array of data sources.
 
 In order to use liquidprompt with Zsh, you should use the following snippet
-with @code{guix home}:
+with Guix Home:
+
 @example
-(services (list ;;...
-            (service home-zsh-service-type
-                     (home-zsh-configuration
-                       (zshrc (list ;;...
-                                ;; This loads liquidprompt
-                                (mixed-text-file \"liquidprompt\"
-                                                 \"[[ $- = *i* ]] && source \" liquidprompt \"/share/liquidprompt/liquidprompt\")
-                                ;; This loads the powerline theme available in liquidprompt
-                                (mixed-text-file \"powerline-theme\"
-                                                 \"source \" liquidprompt \"/share/liquidprompt/themes/powerline/powerline.theme\")))))))
-@end example
-")
-    (license license:agpl3)))
+(service home-zsh-service-type
+         (home-zsh-configuration
+           (zshrc (list ;;...
+                    ;; This loads liquidprompt
+                    (mixed-text-file \"liquidprompt\"
+                                     \"[[ $- = *i* ]] && source \" liquidprompt \"/share/liquidprompt/liquidprompt\")
+                    ;; This loads the powerline theme available in liquidprompt
+                    (mixed-text-file \"powerline-theme\"
+                                     \"source \" liquidprompt \"/share/liquidprompt/themes/powerline/powerline.theme\"))))))
+@end example\n")
+    (license license:agpl3+)))