unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: Konrad Hinsen <konrad.hinsen@fastmail.net>,
	Guix Devel <guix-devel@gnu.org>
Subject: Re: Finding the store path of a package
Date: Wed, 17 Mar 2021 19:27:44 +0100	[thread overview]
Message-ID: <864kh9ws7z.fsf@gmail.com> (raw)
In-Reply-To: <m17dm5oead.fsf@ordinateur-de-catherine--konrad.home>

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	other threads:[~2021-03-17 18:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-17 17:55 Finding the store path of a package Konrad Hinsen
2021-03-17 18:27 ` zimoun [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=864kh9ws7z.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=konrad.hinsen@fastmail.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).