[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Find location of installed package in /gnu/store
From: |
Maxim Cournoyer |
Subject: |
Re: Find location of installed package in /gnu/store |
Date: |
Sat, 15 May 2021 22:58:34 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
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