Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.
When using nix-shell -i ... is it possible to pass custom environment variables to the chained script interpreter (the command in -i)? Reading the man page I don't see a mention of it.
nix-shell -i ...
-i
Doesn't look like there is a way, however env's -S came to rescue:
env
-S
#! /usr/bin/env -S"GHC_ENVIRONMENT=-" nix-shell #! nix-shell -p ghcid #! nix-shell -p "haskellPackages.ghcWithPackages (p: [p.shower])" #! nix-shell -i "ghcid -T main" import Shower (printer) import System.Environment (getEnv) main :: IO () main = do printer =<< getEnv "GHC_ENVIRONMENT"
https://www.srid.ca/haskell-nix.html#haskell-scripts
@Sridhar Ratnakumar --command 'export GHC_ENVIRONMENT=hello; return' might do the trick
--command 'export GHC_ENVIRONMENT=hello; return'
I don't think I can use --command, as this is all in the shebang (ctrl+f shebang in man nix-shell)
--command
man nix-shell
When using
nix-shell -i ...
is it possible to pass custom environment variables to the chained script interpreter (the command in-i
)? Reading the man page I don't see a mention of it.Doesn't look like there is a way, however
env
's-S
came to rescue:https://www.srid.ca/haskell-nix.html#haskell-scripts
@Sridhar Ratnakumar
--command 'export GHC_ENVIRONMENT=hello; return'
might do the trickI don't think I can use
--command
, as this is all in the shebang (ctrl+f shebang inman nix-shell
)