unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Persistent environment variable
@ 2022-12-05 20:38 Reza Housseini
  2022-12-05 21:23 ` Wojtek Kosior via
  2022-12-05 21:35 ` Tobias Geerinckx-Rice
  0 siblings, 2 replies; 4+ messages in thread
From: Reza Housseini @ 2022-12-05 20:38 UTC (permalink / raw)
  To: help-guix


[-- Attachment #1.1.1: Type: text/plain, Size: 418 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

-- 
Reza Housseini

This message is signed with my GnuPG key:

     C0F3 0812 9AF2 80F4 0830 C2C1 C375 C6AF 0512 5C52

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 15557 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Persistent environment variable
  2022-12-05 20:38 Persistent environment variable Reza Housseini
@ 2022-12-05 21:23 ` Wojtek Kosior via
  2022-12-05 21:35 ` Tobias Geerinckx-Rice
  1 sibling, 0 replies; 4+ messages in thread
From: Wojtek Kosior via @ 2022-12-05 21:23 UTC (permalink / raw)
  To: Reza Housseini; +Cc: help-guix

[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Persistent environment variable
  2022-12-05 20:38 Persistent environment variable Reza Housseini
  2022-12-05 21:23 ` Wojtek Kosior via
@ 2022-12-05 21:35 ` Tobias Geerinckx-Rice
  2022-12-07 14:03   ` Reza Housseini
  1 sibling, 1 reply; 4+ messages in thread
From: Tobias Geerinckx-Rice @ 2022-12-05 21:35 UTC (permalink / raw)
  To: Reza Housseini; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 46 bytes --]

So what's the variable?

Kind regards,

T G-R

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Persistent environment variable
  2022-12-05 21:35 ` Tobias Geerinckx-Rice
@ 2022-12-07 14:03   ` Reza Housseini
  0 siblings, 0 replies; 4+ messages in thread
From: Reza Housseini @ 2022-12-07 14:03 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice; +Cc: help-guix


[-- Attachment #1.1.1: Type: text/plain, Size: 497 bytes --]

On 12/5/22 22:35, Tobias Geerinckx-Rice wrote:
> So what's the variable?

It is in fact a bashrc files which defines several variables.
It is kind a crude way of doing things and I did not found any other 
software which has a similar setup in the repository. But without 
sourcing this file you cannot do a lot when using this software (openfoam).

Cheers,


-- 
Reza Housseini

This message is signed with my GnuPG key:

     C0F3 0812 9AF2 80F4 0830 C2C1 C375 C6AF 0512 5C52


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 15557 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-07 14:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-05 20:38 Persistent environment variable Reza Housseini
2022-12-05 21:23 ` Wojtek Kosior via
2022-12-05 21:35 ` Tobias Geerinckx-Rice
2022-12-07 14:03   ` Reza Housseini

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).