From: Wojtek Kosior via <help-guix@gnu.org>
To: Reza Housseini <reza.housseini@gmail.com>
Cc: help-guix@gnu.org
Subject: Re: Persistent environment variable
Date: Mon, 5 Dec 2022 22:23:39 +0100 [thread overview]
Message-ID: <20221205222339.3431d108.koszko@koszko.org> (raw)
In-Reply-To: <1b93d973-204f-15c5-6148-1e943fb95a96@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1875 bytes --]
> Hi List
>
> Is there a possibility to set an environment variable in a package
> recipe which is persistent after the build of the package? So if you
> would install the package the environment variable is present then.
> Or is this an anti pattern?
>
> Thanks for any inputs.
>
> Cheers,
> Reza
>
For exporting various kinds of *search paths* in environment variables,
there's a special facility described here[1].
Alternatively, if in your use case it is sufficient to have the
variable always passed to some Guix-created executable, you might want
to look at the `wrap-program` function from `(guix build utils)`. You
can look at how it is used by existing packages. For things like this I
usually use a command like
grep -RE 'wrap-prog' -A10 -B2 ~/.config/guix/current/share/guile/site/3.0/gnu/packages | less
Unfortunately, I don't feel competent enough to say whether something
is an anti-pattern. If any of those 2 solutions fits your needs, that's
great. If not, I hope someone else will help you out :)
Wojtek
[1] https://guix.gnu.org/manual/devel/en/html_node/Search-Paths.html
-- (sig_start)
website: https://koszko.org/koszko.html
PGP: https://koszko.org/key.gpg
fingerprint: E972 7060 E3C5 637C 8A4F 4B42 4BC5 221C 5A79 FD1A
Meet Kraków saints! #14: saint Jan Kanty
Poznaj świętych krakowskich! #14: święty Jan Kanty
https://pl.wikipedia.org/wiki/Jan_Kanty
-- (sig_end)
On Mon, 5 Dec 2022 21:38:14 +0100
Reza Housseini <reza.housseini@gmail.com> wrote:
> Hi List
>
> Is there a possibility to set an environment variable in a package
> recipe which is persistent after the build of the package? So if you
> would install the package the environment variable is present then.
> Or is this an anti pattern?
>
> Thanks for any inputs.
>
> Cheers,
> Reza
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2022-12-05 21:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-05 20:38 Persistent environment variable Reza Housseini
2022-12-05 21:23 ` Wojtek Kosior via [this message]
2022-12-05 21:35 ` Tobias Geerinckx-Rice
2022-12-07 14:03 ` Reza Housseini
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=20221205222339.3431d108.koszko@koszko.org \
--to=help-guix@gnu.org \
--cc=koszko@koszko.org \
--cc=reza.housseini@gmail.com \
/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.
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).