all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Finding the store path of a package
@ 2021-03-17 17:55 Konrad Hinsen
  2021-03-17 18:27 ` zimoun
  0 siblings, 1 reply; 13+ messages in thread
From: Konrad Hinsen @ 2021-03-17 17:55 UTC (permalink / raw)
  To: Guix Devel

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.


^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: Finding the store path of a package
@ 2024-04-22 23:58 Nikolaos Chatzikonstantinou
  0 siblings, 0 replies; 13+ messages in thread
From: Nikolaos Chatzikonstantinou @ 2024-04-22 23:58 UTC (permalink / raw)
  To: konrad.hinsen, guix-devel

>Ludovic Courtès wrote:
>> Yes.  In the presence of grafts, run “guix build PKG”.  That always
>> gives you the store file name of PKG, 100% reliable!
>At the cost of a few hours of CPU time, in the worst case.
>> I regularly do things like:
>>
>>   ls $(guix build PKG)/bin
>>   find $(guix build PKG) -name …
>What I am looking for is the equivalent of
>   ls $(guix build PKG)
>that fails in whatever way for packages that are not in the store, but
>guarantees (1) not adding anything to the store and (2) response times
>short enough for interactive user interfaces.

You can also try guix size $PKG.

Regards,
Nikolaos Chatzikonstantinou


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-05-04 17:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-17 17:55 Finding the store path of a package Konrad Hinsen
2021-03-17 18:27 ` zimoun
2021-03-18  8:43   ` Konrad Hinsen
2021-03-18 10:45     ` Konrad Hinsen
2021-03-18 12:04       ` zimoun
2021-03-20 13:46       ` Ludovic Courtès
2021-03-22  7:39         ` Konrad Hinsen
2021-03-22 10:03           ` zimoun
2021-03-22 13:12             ` Konrad Hinsen
2021-03-22 16:22           ` Ludovic Courtès
2021-03-22 17:58             ` Konrad Hinsen
2021-04-19  7:08             ` Konrad Hinsen
  -- strict thread matches above, loose matches on Subject: below --
2024-04-22 23:58 Nikolaos Chatzikonstantinou

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.