unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Phil Beadling <phil@beadling.co.uk>
Cc: help-guix <help-guix@gnu.org>
Subject: Re: Find location of installed package in /gnu/store
Date: Sat, 15 May 2021 22:58:34 -0400	[thread overview]
Message-ID: <875yzjpep1.fsf@gmail.com> (raw)
In-Reply-To: <CAOvsyQu5qGqjH6dsn3FUKmkkyi5TVk-UwwMmZzHZ5eWo7NoABg@mail.gmail.com> (Phil Beadling's message of "Sat, 15 May 2021 03:28:01 +0100")

Hello Phil,

Phil Beadling <phil@beadling.co.uk> writes:

> Hi,
>
> Given a package definition, eg icedtea-8's JDK, how can can I determine the
> location of the installed package in my /gnu/store?
>
> There doesn't seem to be anything on the package module itself, presumably
> because this is static data, and what I need is something to calculate the
> hash of the resulting install specific to my Guix?

From the command line API, the way to retrieve a package's store file
name is by doing:

$ guix build package

> The aim is to use this to derivive the JDK include directories in a generic
> way for some scripts I'm writing, such that I don't need to update them
> each time the JDK hash changes after a guix pull.

If you prefer to use the Guix API from Guile, you could use something
like:

--8<---------------cut here---------------start------------->8---
(use-modules (guix derivations)
             (guix gexp)
             (guix store)
             (gnu packages base))

(let* ((hello-drv (with-store store
                    (run-with-store store (lower-object hello))))
       (hello-store-path (derivation->output-path hello-drv)))

  (format #t "~a~%" hello-store-path)
  hello-store-path)
--8<---------------cut here---------------end--------------->8---

HTH!

Maxim


      parent reply	other threads:[~2021-05-16  2:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-15  2:28 Phil Beadling
2021-05-15  8:28 ` Edouard Klein
2021-05-15 16:27   ` Phil Beadling
2021-05-15  9:17 ` Björn Höfling
2021-05-16  2:58 ` Maxim Cournoyer [this message]

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=875yzjpep1.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=help-guix@gnu.org \
    --cc=phil@beadling.co.uk \
    --subject='Re: Find location of installed package in /gnu/store' \
    /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

unofficial mirror of help-guix@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guix-user/0 guix-user/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-user guix-user/ https://yhetil.org/guix-user \
		help-guix@gnu.org
	public-inbox-index guix-user

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.user
	nntp://news.gmane.io/gmane.comp.gnu.guix.user


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git