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 ...
Doesn't look like there is a way, however env's -S came to rescue:
#! /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"
@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)