guix-devel
[Top][All Lists]
Advanced

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

Re: Finding the store path of a package


From: zimoun
Subject: Re: Finding the store path of a package
Date: Wed, 17 Mar 2021 19:27:44 +0100

Hi Konrad,

On Wed, 17 Mar 2021 at 18:55, Konrad Hinsen <konrad.hinsen@fastmail.net> wrote:

> 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.

does “guix build <package> -n” fit your use-case?


> 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.

Well, ’package-output’ in (guix packages) is what you need, I guess.

--8<---------------cut here---------------start------------->8---
$ guix gc -D $(guix build hello)
0.1 MB will be downloaded:
   /gnu/store/a462kby1q51ndvxdv3b6p0rsixxrgx1h-hello-2.10
substituting /gnu/store/a462kby1q51ndvxdv3b6p0rsixxrgx1h-hello-2.10...
downloading from 
https://ci.guix.gnu.org/nar/lzip/a462kby1q51ndvxdv3b6p0rsixxrgx1h-hello-2.10 ...
 hello-2.10  51KiB                                                          
454KiB/s 00:00 [##################] 100.0%

finding garbage collector roots...
[0 MiB] deleting '/gnu/store/a462kby1q51ndvxdv3b6p0rsixxrgx1h-hello-2.10'
deleting `/gnu/store/trash'
deleting unused links...
note: currently hard linking saves 20885.94 MiB

$ guix repl
GNU Guile 3.0.5
Copyright (C) 1995-2021 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guix-user)> ,use(gnu packages base) ; hello
scheme@(guix-user)> ,use(guix packages) ; package-output
scheme@(guix-user)> ,use(guix store) ; with-store
scheme@(guix-user)> (with-store store (package-output store hello))
$1 = "/gnu/store/a462kby1q51ndvxdv3b6p0rsixxrgx1h-hello-2.10"
scheme@(guix-user)> ,q

$ ls /gnu/store/a462kby1q51ndvxdv3b6p0rsixxrgx1h-hello-2.10
ls: cannot access '/gnu/store/a462kby1q51ndvxdv3b6p0rsixxrgx1h-hello-2.10': No 
such file or directory
--8<---------------cut here---------------end--------------->8---



Hope that helps,
simon




reply via email to

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