A small set of Nix utility functions to allow for reading env files and interpolating them into mkShell's shellHook.
Read an env file given a path and return an attrset.
env-utils.readEnvFile ./test-assets/environment.env
# { HELLO = "world"; GOODBYE = "joe"; };Format an attribute set as a list of shell variable exports.
env-utils.formatAttrsAsShellVars {
FOO = "bar";
SERVER = "localhost:3000";
PORT = 3000;
}
# export FOO="bar"
# export PORT="3000"
# export SERVER="localhost:3000"Read an env file contents and parse them into export statements.
env-utils.parseEnvFile ./test-assets/environment.env
# export GOODBYE="joe"
# export HELLO="world"