From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id YHSKD2SGn2ByNAEAgWs5BA (envelope-from ) for ; Sat, 15 May 2021 10:29:24 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 4H4EC2SGn2AgaQAAbx9fmQ (envelope-from ) for ; Sat, 15 May 2021 08:29:24 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 72FDF1F172 for ; Sat, 15 May 2021 10:29:23 +0200 (CEST) Received: from localhost ([::1]:57040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhpfm-0001pH-1y for larch@yhetil.org; Sat, 15 May 2021 04:29:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhpfR-0001nH-41 for help-guix@gnu.org; Sat, 15 May 2021 04:29:02 -0400 Received: from sender4-op-o11.zoho.com ([136.143.188.11]:17123) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhpfP-0005TQ-17 for help-guix@gnu.org; Sat, 15 May 2021 04:29:00 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1621067327; cv=none; d=zohomail.com; s=zohoarc; b=Gn/CFWZVyhxZwYwBZD1c3MWA9K73wiFppshJ+aJYMCHjbG65xfXRRQ7R5NrMJjCrLMXleNjysG+i3ptEKtjp/176hAS/ubRBk3L5zmhJkfMkQHz4ofHTyh4eUkSX6jne06EVw7nE4N55/QID8c+Vp9K4CyJPfhABrgOCTr7DdjE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621067327; h=Content-Type:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=KV5nZI0bil3bkbvgnQVuzHU9P7metu23NvY5Q+czFsg=; b=czM7lcX5xHRX5AxeUv4Udpht1MX5kqBunNxd+rF1BR+jlHDhUqtmUHbZazbKIEEFutT0qbAOVLc9Nkh41J7KBfNv0HhVz2v6TmLWkUC99puSk2lE2Y1PW+QzmFKQ4abESDkniX79+bSphmHa0U9Dq2dntni6Rx2MbqlYr4yUzFo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rdklein.fr; spf=pass smtp.mailfrom=edou@rdklein.fr; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1621067327; s=zoho; d=rdklein.fr; i=edou@rdklein.fr; h=References:From:To:Cc:Subject:In-reply-to:Message-ID:Date:MIME-Version:Content-Type; bh=KV5nZI0bil3bkbvgnQVuzHU9P7metu23NvY5Q+czFsg=; b=ZCvn3mbLP5VBueU2A0TdDOR8qUM/7Hzak/AoGPlw/M4uvdPo41z9TZWHqDYKgKM0 IXHrsWL2S02fqUtLy7BeU2thmvCCDDkWhxTo5hZB2fDJhawz6trrvCYkApZpGHSqt/8 Cpf3HwDa7XCr54ghsgwR/rV3RwPQpsAOi6+gItYY= Received: from Rasoir (lfbn-idf3-1-808-29.w90-3.abo.wanadoo.fr [90.3.133.29]) by mx.zohomail.com with SMTPS id 1621067325183777.5822750275967; Sat, 15 May 2021 01:28:45 -0700 (PDT) References: User-agent: mu4e 1.4.15; emacs 27.2 From: Edouard Klein To: Phil Beadling Subject: Re: Find location of installed package in /gnu/store In-reply-to: Message-ID: <87h7j4ieoq.fsf@rdklein.fr> Date: Sat, 15 May 2021 10:28:21 +0200 MIME-Version: 1.0 Content-Type: text/plain X-ZohoMailClient: External Received-SPF: pass client-ip=136.143.188.11; envelope-from=edou@rdklein.fr; helo=sender4-op-o11.zoho.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: help-guix@gnu.org Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1621067363; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=KV5nZI0bil3bkbvgnQVuzHU9P7metu23NvY5Q+czFsg=; b=Lqnz17kC2SQu2YtiW67kYnCANcWjXivQGWTwOAhjIk0J2Moqmtoa2R9yIbnTtHC59+Y2wr rnPwHdiagyMaL+7AE+93JB/jwAunOwGIiQvXpdpNd0nmuBZYeLWjA9iLWK1jW9P1L75BVQ 93aipeFsh3e+0HorDdWOrmLDfJ3XM+E+gn/j5drT6OM8ZTh6yVbc3bFcmvZBHYEvtVub2q Ws9oWwMTIBwZBYbLG92LE7vxKtdUiQNJ8EYQVyG0dYzWPp6TJx9sez6pwOTZOjnY1plCjY sJuG0kJCGhDfDzbBkW60pPQhbIW2/y29GKtffDcaqAKgu9Yx2CLl2acBSvGvJw== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1621067363; a=rsa-sha256; cv=pass; b=PduAdsBSu2eQuLsxQPbUEmITYjATbTSkIXar4YXP4AznLMDyHxMcPiteEMfFPwQgTI4AMU hfWOCvqaxafycmUw3/PkovxNnObj6YSq2GxyaGvwwtrym01cP1gZro1wNsSfcLbpXnFB9W fBi9zhoOphT6V8jFR+Qfjr9fYAYobgglPTQqtxFxIaIr0Mw3/SGg4SptMYuTfqfmB31YK3 3NfjSfQl9X7HTcyv+6CujpkP4lGCZsVkIg+MgDCBE4+jH84HzIiBLeqQzOLOEEWYHpMhmd TY4GG+oWyHlCM1hjzJcv2N13mw6jYCHQ1fHYCY62JsED3sdE1yR8BPVFAckkjQ== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=rdklein.fr header.s=zoho header.b=ZCvn3mbL; arc=pass ("zohomail.com:s=zohoarc:i=1"); dmarc=none; spf=pass (aspmx1.migadu.com: domain of help-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=help-guix-bounces@gnu.org X-Migadu-Spam-Score: -3.45 Authentication-Results: aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=rdklein.fr header.s=zoho header.b=ZCvn3mbL; arc=pass ("zohomail.com:s=zohoarc:i=1"); dmarc=none; spf=pass (aspmx1.migadu.com: domain of help-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=help-guix-bounces@gnu.org X-Migadu-Queue-Id: 72FDF1F172 X-Spam-Score: -3.45 X-Migadu-Scanner: scn0.migadu.com X-TUID: qQOxsZRbwumw Hi ! This is where G-expressions will help you :) Basically the path you need does not exist in the same "strata" as the code of the package. The following code will define a build-gexp function that evaluates a G-expression and prints the resulting directory in the store. You can try it in "guix repl" or with "guix build -f FILE" https://guix.gnu.org/manual/en/guix.html#G_002dExpressions A G-exp begins with #~ and withing the following expr, any piece of code prefixed by #$ is recursively replaced by its value, but only if this value is a primitive value (string, int,...) or a package. If it is a package, it gets replaced by the path in the store of that package. So to give a short answer, run the following into the REPL to get your path: (use-modules (guix gexp) (guix store) (guix derivations) (gnu packages java)) (define (build-gexp gexp) "Build GEXP using the local daemon." (let ((derivation (run-with-store (open-connection) (gexp->derivation "noname" gexp)))) (build-derivations (open-connection) (list derivation)) (derivation-output-path (assoc-ref (derivation-outputs derivation) "out")))) (build-gexp (with-imported-modules '((guix build utils)) #~(begin (use-modules (guix build utils)) (mkdir-p (string-append #$output "/bin")) (with-output-to-file (string-append #$output "/bin/helloworld.sh") (lambda _ (display (string-append "Iced tea lives at:" #$icedtea-8))))))) This wil output a path, in my case /gnu/store/vv5sc5l488xxysyz88aadjj3fwnqr2xa-noname and in it you'll have the file: /gnu/store/vv5sc5l488xxysyz88aadjj3fwnqr2xa-noname/bin/helloworld.sh which contains Iced tea lives at:/gnu/store/vaqdvsqdv5mads38dp6pc5827pdgnmb3-icedtea-3.7.0 Given your stated use case, you may be interested in the following upcoming patch: https://issues.guix.gnu.org/48277 It will let you wrap any executable in the appropriate env vars, so I guess you will be able to do something like #$(wrap-in-search-paths #~(string-append #$output "/bin/your-script") (list icedtea-8)) Hopefully icedtea-8 sets the correct search paths, but I believe it does. Cheers, Edouard. Phil Beadling 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? > > eg > scheme@(guix-user) [3]> (package-outputs icedtea-8) > $8 = ("out" "jdk" "doc") > scheme@(guix-user) [3]> > > I'd like to return this location using the package name or definition as an > input: > /gnu/store/i3vf1a49m0abcjqza19mb4mkjmc6k60n-icedtea-3.7.0-jdk/ > > 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. > > Cheers, > Phil.