guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Finding the store path of a package


From: Konrad Hinsen
Subject: Finding the store path of a package
Date: Wed, 17 Mar 2021 18:55:54 +0100

Dear Guix experts,

I wonder if there is a straightforward way to find the store path
corresponding to a package, assuming that the package actually is in the
store. I don't care if it's done via the CLI or via Guile code.

Use case: Looking at the files inside a package. What I do now is "ls
/gnu/store/*<package-name>*", but that usually lists many variants of
the package, and I don't know which of them actually is the current one.

I came up with some Guile code that does the job:

   (define (store-path specification)
     (let*-values (((package output)
                    (specification->package+output specification))
                   ((entry)
                    (package->manifest-entry package output))
                   ((l-entry)
                    (with-store store
                      (run-with-store store
                        (lower-manifest-entry entry (%current-system))))))
       (manifest-entry-item l-entry)))

but it also downloads/builds the package if it's not yet in the store,
which is not what I want. In fact, I don't care what happens then the
package is not in the store. Returning a non-existing path is fine,
as is raising an error or returning #f.

Another attempt is "guix package –-list-installed", but this works only
for packages installed in a profile. I am shifting more and more to
on-the-fly environments, meaning that many packages in my store belong
to no profile.

Cheers,
  Konrad.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]