From 0e7f73fd11e396c5e5fa898178d3872eb676f234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Mon, 10 Jun 2019 07:39:43 -0400 Subject: [PATCH] add NIX_KEEP to add --keep to pyre nix shell MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- nix/shell.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nix/shell.sh b/nix/shell.sh index 324c2aa6fb..ee55da0243 100755 --- a/nix/shell.sh +++ b/nix/shell.sh @@ -32,11 +32,17 @@ if command -v "nix" >/dev/null 2>&1; then exec nix-shell --show-trace --argstr target-os ${TARGET_OS} else is_pure='' - if [ "${TARGET_OS}" != 'all' ] && [ "${TARGET_OS}" != 'ios' ] && [ "${TARGET_OS}" != 'windows' ]; then + if [[ "${TARGET_OS}" != 'all' ]] && [[ "${TARGET_OS}" != 'ios' ]] && [[ "${TARGET_OS}" != 'windows' ]]; then is_pure='--pure' pure_desc='pure ' fi + # This variable allows specifying which env vars to keep for Nix pure shell + # The separator is a semicolon + keep_opts='' + if [[ -n "${NIX_KEEP}" ]]; then + keep_opts="--keep ${NIX_KEEP//;/ --keep }" + fi echo -e "${GREEN}Configuring ${pure_desc}Nix shell for target '${TARGET_OS}'...${NC}" - exec nix-shell ${is_pure} --show-trace --argstr target-os ${TARGET_OS} --run "$@" + exec nix-shell ${is_pure} ${keep_opts} --show-trace --argstr target-os ${TARGET_OS} --run "$@" fi fi