0

After I have set up a development shell (e.g., by starting a PostgreSQL cluster with a particular configuration, exporting several environment variables, "installed" a bunch of applications via nix-shell), I want to start tmux where everything from the calling shell is available.

By default, tmux ignores my environment variables, and all the solutions I've found spell out how one has to re-declare each variable again, one-by-one. (Could be wrong though as I'm also having trouble deciphering the relevant section of the tmux man page.)

I like the static, declarative approach in production, but sometimes I just want to quickly hack away at stuff.

1 Answer 1

4

@Phluks' para-phrased comment:

This can be achieved using the '-L' (or '-S') option. These start a new server with the current environment. E.g., tmux -L <arbitrary_name> creates a new session in the server on that socket, with the same environment as in the calling shell. tmux -L <arbitrary_name> list-sessions will list the sessions on that particular server, etc.

For example:

$ export LOFA=27

$ tmux -L miez

...(tmux-session)... $ echo $LOFA
27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .