Classic confinement for direnv


direnv is a very well known environment variable manager for your shell. It knows how to hook into bash, zsh and fish shell to load or unload environment variables depending on your current directory. This allows you to have project-specific environment variables and not clutter the " /.profile" file.

Due to the way it works it needs free access to the filesystem and environment requires clasic confinement.

You can refer to for more information on direnv while packaging can be found at



I don’t think this should need classic confinement. What about the way it works requires it have ‘free access to the filesystem’?


direnv loads or unloads environment variables depending on your current directory. As per the direnv man page, it checks for the existence of a “.envrc” file in the current and parent directories. If the file exists, it is loaded into a bash sub-shell and all exported variables are then captured by direnv and then made available to your current shell.

“For direnv to work properly it needs to be hooked into the shell. Each shell has it’s own extension mechanism.”[1]


This snap could use personal-files to enumerate the different files needed by the extension mechanisms. Can you list all of the files direnv needs access to for extending the shells?


Direnv loads ‘.env’ files and create env variables. You can have ‘.env’ files literally anywhere in the system as you wich and usually you can find them in project folders. This depends on the user.


so, you could use the home and removable-media plugs to load .env files from most reasonable places, and a personal-files to have $HOME/.env. What else would you need?

edit to add: the .env files can’t be the extension mechanism, so I’m missing something.


I find the restrictions to be very strict for such a generic tool.


i am not sure that “the .env files can’t be the extension mechanism” ?

the idea is that in any file you enter if you habe a .ent it will be loaded and change your environment variable till you exit the folder …