Questions tagged [direnv]

An environment switcher for the shell to unclutter your .profile

direnv is an environment switcher for the shell. It knows how to hook into bash, zsh, tcsh, fish shell and elvish to load or unload environment variables depending on the current directory.

This allows project-specific environment variables without cluttering your ~/.profile (or ~/.bashrc/etc).

27 questions
1
vote
1 answer

Why is the variable PS1 a problem for direnv when sourcing venv

I use direnv v2.21.2 and want that the hook activates my previous created .venv. If I use just source .venv/bin/activate my environment gets activated, but PS1 reacts with an error message. I actually have no clue what to do with the PS1 variable…
MaKaNu
  • 762
  • 8
  • 25
1
vote
1 answer

How do I execute commands serially inside a shell script?

I want to write a shell script to execute some commands in sequence (the next one starts only after the previous has finished and so on). I've never written a bash script before and I couldn't find the appropriate sequence. I know that in the…
Kawd
  • 4,122
  • 10
  • 37
  • 68
1
vote
1 answer

"direnv export bash": Generated variable gets a dollar sign $ at the begin for no reason?

In my script after I've cded inside a folder I check if direnv command is available in the system and if a .envrc file has been already created. If so, I'm generating a python virtual env with: direnv allow eval "$(direnv export bash)" For some…
Barnercart
  • 1,523
  • 1
  • 11
  • 23
1
vote
1 answer

Deploying Flask APP with UWSGI,Nginx,direnv and systemd

I have created an API using FLASK which I am trying to deploy on a linux server by creating a systemd service. I have used direnv to setup input parameters to the app like database connections. Below is what the file looks like : The uwsgi config…
Abhi
  • 163
  • 2
  • 14
1
vote
2 answers

Stop direnv showing all environment variables on load

I have direnv installed, and I was wondering if there was a way of stopping it from showing all of the environment variables it loads? The output lines it currently shows are: direnv: loading .envrc direnv: export +FOO +BAR +FOO2 +BAR2 +FOO3 +BAR3…
LomaxOnTheRun
  • 592
  • 1
  • 8
  • 21
1
vote
1 answer

Sign Github commits using dynamic signingkey

I have a Github account linked with 2 email addresses, (Personal + work). I'm only able to sign commits coming from one account, using git config --global user.signingkey MySigningKey because the key is associated with one email. I'm using direnv to…
Nicolas Del Valle
  • 1,384
  • 15
  • 20
0
votes
0 answers

direnv cannot find .envrc file even it does exist

I set up a virtual environment for a Django-React project. I have created the .bashrc in the user home directory, and .envrc file in the root folder of the project repo. But when I tried 'direnv allow' it always return '.envrc does not exit' with a…
Lemoonh
  • 1
  • 1
0
votes
1 answer

Terraform init: Error: failed to open temporary file with direnv

I used direnv to install programs from a nix flake like this: .envrc: use flake ~/Documents/nixdesktop/shells/myshell#terraformAndOthers myshell/flake.nix: { description = "Shells with terraform, jdk, etc "; inputs = { nixpkgs.url =…
yonran
  • 18,156
  • 8
  • 72
  • 97
0
votes
0 answers

How to back to normal terminal setting after changing with prompt color

Recently, I had to change the color of the prompt when I enter a specific directory and, back to default prompt color when I leave a specific directory. To change the color of the prompt when enter a specific directory, I used a combination of…
John Smith
  • 21
  • 4
0
votes
0 answers

use direnv then the gopls error said can't import fmt

I started using direnv recently. I created a .envrc file in my project’s root directory. There is only one line in .envrc: export GOPATH=$(pwd) I use vim with coc & gopls to write go, but when I open main.go coc shows this error Error [compiler]…
happy coding
  • 27
  • 1
  • 6
0
votes
0 answers

Is make installed with xcode?

Backstory: Learning to code - python web development. I am trying to install direnv to have virtual environments. It says it has a dependency of make and go. https://direnv.net/ Question: I was looking up make and it appears it might be…
Harry L
  • 95
  • 1
  • 7
-1
votes
1 answer

direnv with WSL2 - not loading files when used with source_env_if_exists

(this is to document a specific behavior that may affect users mixing windows and wsl for work) I use a hierarchy of directories with .envrc in them to manage environment. file content is like export BASE_URL="url" source_env_if_exists…
Jayan
  • 18,003
  • 15
  • 89
  • 143
1
2