Subject: Re: [PATCH v10] gnu: Add jpm.

From: Omar Bassam <[email-masked]>
Date: Sun, 06 Oct 2024 16:21:05 +0300

Thank you Suhail for helping me out wiht this patch. I have some
questions about v10 patch about some parts that I don't fully understand.

> * gnu/packages/lisp.scm (jpm): New variable.
>
> Change-Id: I730ef2f5c874c5142a580a42af76180e95d93ccd
> Signed-off-by: Suhail <[email-masked]>
> ---
>  gnu/packages/lisp.scm | 77 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 77 insertions(+)
>
> diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
> index 6c16d8ab71..48cf9dffab 100644
> --- a/gnu/packages/lisp.scm
> +++ b/gnu/packages/lisp.scm
> @@ -29,6 +29,7 @@
>  ;;; Copyright © 2024 Andreas Enge <[email-masked]>
>  ;;; Copyright © 2024 bigbug <[email-masked]>
>  ;;; Copyright © 2024 Ashish SHUKLA <[email-masked]>
> +;;; Copyright © 2024 Omar Bassam <[email-masked]>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -62,6 +63,7 @@ (define-module (gnu packages lisp)
>    #:use-module (guix build-system gnu)
>    #:use-module (guix build-system haskell)
>    #:use-module (guix build-system trivial)
> +  #:use-module ((guix search-paths) #:select ($SSL_CERT_DIR $SSL_CERT_FILE))
>    #:use-module (gnu packages admin)
>    #:use-module (gnu packages algebra)
>    #:use-module (gnu packages autotools)
> @@ -69,6 +71,7 @@ (define-module (gnu packages lisp)
>    #:use-module (gnu packages bash)
>    #:use-module (gnu packages bdw-gc)
>    #:use-module (gnu packages boost)
> +  #:use-module (gnu packages certs)

If we don't need nss-verts, do we still need this line?

>    #:use-module (gnu packages check)
>    #:use-module (gnu packages compression)
>    #:use-module (gnu packages crypto)
> @@ -917,6 +920,80 @@ (define-public janet
>  assembler, PEG) is less than 1MB.")
>      (license license:expat)))
>  
> +(define-public jpm
> +  (package
> +    (name "jpm")
> +    (version "1.1.0")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/janet-lang/jpm")
> +             (commit (string-append "v" version))))
> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32 "05rdxigmiy7vf93s16a8n2029lq33073jccz1rjl4iisxj6piw4l"))))
> +    (build-system copy-build-system)
> +    (arguments
> +     (list
> +      #:phases #~(modify-phases %standard-phases
> +                   (add-after 'unpack 'fix-paths
> +                     (lambda* (#:key inputs #:allow-other-keys)
> +                       (substitute* "configs/linux_config.janet"
> +                         (("/usr/local")
> +                          #$output)
> +                         (("\"cc\"")
> +                          (string-append "\""
> +                                         #$gcc "/bin/gcc" "\""))
> +                         (("\"c\\+\\+\"")
> +                          (string-append "\""
> +                                         #$gcc "/bin/g++" "\""))
> +                         (("\"git\"")
> +                          (string-append "\""
> +                                         #$git "/bin/git" "\""))
> +                         (("\"curl\"")
> +                          (string-append "\""
> +                                         #$curl "/bin/curl" "\"")))
> +                       (substitute* "jpm/shutil.janet"
> +                         (("cp")
> +                          (string-append #$coreutils "/bin/cp")))
> +                       (setenv "PREFIX"
> +                               #$output)))
> +                   (replace 'install
> +                     (lambda _
> +                       (for-each (lambda (dir)
> +                                   (mkdir-p (string-append #$output "/" dir)))
> +                                 '("lib/janet/jpm" "share/man/man1"))
> +                       (invoke "janet" "bootstrap.janet"
> +                               "configs/linux_config.janet")
> +                       (wrap-program (string-append #$output "/bin/jpm")
> +                         `("JANET_HEADERPATH" ":" =
> +                           (,(string-append #$janet "/include/janet")))
> +                         `("JANET_LIBPATH" ":" =
> +                           (,(string-append #$janet "/lib")))))))))
> +    (inputs (list bash-minimal))
> +    (propagated-inputs (list janet
> +                             ;; Lazily resolve the gcc-toolchain to avoid a
> +                             ;; circular dependency.
> +                             (module-ref (resolve-interface '(gnu packages
> +                                                              commencement))
> +                                         'gcc-toolchain)))

Since we no longer need gcc-toolchain and we are just using gcc
directly, should we remove this module-ref expression and just add gcc as a propagated input?

> +    ;; NOTE: Below ensures that the user provides the CA certificates they
> +    ;; desire (as opposed to bundling `nss-certs' in propagated-inputs, which
> +    ;; isn't recommended) and when they do, that they are respected.

Why isn't bundling nss-certs recommended?

> +    ;;
> +    ;; FIXME: It's unclear why `search-paths', instead of
> +    ;; `native-search-paths', doesn't work.

What are the difference between search-paths and
native-search-paths.
And were you able to run the "jpm install" command
without nss-certs. Because, for me I was unable to do so.
When I added back the nss-certs in propagated-inputs, it worked fine.

> +    (native-search-paths
> +     (list $SSL_CERT_DIR $SSL_CERT_FILE))
> +    (home-page "https://janet-lang.org/")
> +    (synopsis "Janet Project Manager for the Janet programming language")
> +    (description
> +     "@code{jpm} is the Janet Project Manager tool.  It is a build
> +tool and its main uses are installing dependencies, compiling C/C++ to native
> +libraries, and other management tasks for Janet projects.")
> +    (license license:expat)))
> +
>  (define-public lisp-repl-core-dumper
>    (package
>      (name "lisp-repl-core-dumper")
>
> base-commit: 73ec844389e91cb0f5a2647070516fc8d19d8730

Sorry I had to send this message twice. This is the first time sending
from gnus in emacs and I didn't know the difference between a "reply"
and a "wide-reply"

BRs,
Omar