Skip to content

Instantly share code, notes, and snippets.

@paulovieira
Created May 17, 2023 10:11
Show Gist options
  • Save paulovieira/5363a880df1020b950dd4c4933b66054 to your computer and use it in GitHub Desktop.
Save paulovieira/5363a880df1020b950dd4c4933b66054 to your computer and use it in GitHub Desktop.
basic nix-shell that imports env variables from a separate file
# comment
MY_VAR_1=aaa
MY_VAR_2=bbb
{ 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