unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Setting environment variables in a profile
@ 2022-05-19 19:43 Théo Maxime Tyburn
  2022-05-19 20:34 ` Maxime Devos
  0 siblings, 1 reply; 3+ messages in thread
From: Théo Maxime Tyburn @ 2022-05-19 19:43 UTC (permalink / raw)
  To: guix-devel

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


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

end of thread, other threads:[~2022-05-19 21:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-19 19:43 Setting environment variables in a profile Théo Maxime Tyburn
2022-05-19 20:34 ` Maxime Devos
2022-05-19 21:41   ` Théo Maxime Tyburn

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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