From: "Théo Maxime Tyburn" <theo.tyburn@gmail.com>
To: guix-devel@gnu.org
Subject: Setting environment variables in a profile
Date: Thu, 19 May 2022 21:43:12 +0200 [thread overview]
Message-ID: <877d6h47bw.fsf@gmail.com> (raw)
Hi,
I would like some environement variables to be present whenever I enter
a shell using `guix shell -p ...`.
Is there an easy way to do this?
I tried it this way: in the manifest file I use to define the
profile, I define a package and set some
(native)-search-paths. Unfortunatly this It didn’t work for some
reason I ignore. The environment variables are not there when I enter
the shell or source the profile directly. Here is the code
--8<---------------cut here---------------start------------->8---
(define my-env
(package
(version "0")
(source #f)
(build-system trivial-build-system)
(arguments '(#:builder (mkdir %output)))
(synopsis "Empty package")
(description
"This package creates its store directory and nothing more.")
(home-page #f)
(license license:gpl3+)
(name "my-env")
(native-search-paths
(list (search-path-specification
(variable "PYTHONPATH")
(files '("/home/teddd/..."
"/home/teddd/..."
"/home/teddd/...")))
(search-path-specification
(variable "BLENDER_USER_CONFIG")
(files '("...")))
(search-path-specification
(variable "BLENDER_OPTIONS")
(files '("--python-use-system-env")))
))
(arguments '(#:builder (mkdir %output)))
))
--8<---------------cut here---------------end--------------->8---
Another problem I would have with this method is that the last environment
variable I want to set (BLENDER_OPTIONS) is not even a path. I am not
sure it is possible to sepcify a file-type to be "just a string".
Anyway I think this seems to be the wrong approach.
How would you approach this?
I konw direnv and other utils to set environment variables exist, I
miself use a bash script to initialize my profiles with variables I
want. But it would just be much more convinient to be able to define arbitrary env
variables in a guix manifest and enter a shell with everything you need.
Best,
Théo
next reply other threads:[~2022-05-19 20:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-19 19:43 Théo Maxime Tyburn [this message]
2022-05-19 20:34 ` Setting environment variables in a profile Maxime Devos
2022-05-19 21:41 ` Théo Maxime Tyburn
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877d6h47bw.fsf@gmail.com \
--to=theo.tyburn@gmail.com \
--cc=guix-devel@gnu.org \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.