Created
May 17, 2023 10:11
-
-
Save paulovieira/5363a880df1020b950dd4c4933b66054 to your computer and use it in GitHub Desktop.
basic nix-shell that imports env variables from a separate file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# comment | |
MY_VAR_1=aaa | |
MY_VAR_2=bbb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs ? import <nixpkgs> {} }: | |
pkgs.mkShell { | |
buildInputs = with pkgs; [ | |
nodejs-18_x | |
]; | |
shellHook = '' | |
# Mark variables which are modified or created for export. | |
set -a | |
#source env.sh | |
# or to make it relative to the directory of this shell.nix file | |
source ${toString ./env.sh} | |
set +a | |
''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment