From 7ab5cf053fc23b0e4811007706f727c8e4c473cf Mon Sep 17 00:00:00 2001 From: Pedro Pombeiro Date: Tue, 26 Nov 2019 11:24:06 +0100 Subject: [PATCH] nix: fix shell bootstrapper --- nix/bootstrapped-shell.nix | 41 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/nix/bootstrapped-shell.nix b/nix/bootstrapped-shell.nix index 889493174a..8fca6bfd74 100644 --- a/nix/bootstrapped-shell.nix +++ b/nix/bootstrapped-shell.nix @@ -5,29 +5,28 @@ { stdenv, mkShell, target-os, git }: -let - shell' = shellAttr: - shellAttr // { - nativeBuildInputs = (shellAttr.nativeBuildInputs or [ ]) ++ [ git ]; - TARGET_OS = target-os; - shellHook = '' - set -e +# Declare a specialized mkShell function which adds some bootstrapping +# so that e.g. STATUS_REACT_HOME is automatically available in the shell +attrs: + (mkShell.override({ inherit stdenv; }) attrs) + .overrideAttrs(super: { + nativeBuildInputs = (super.nativeBuildInputs or [ ]) ++ [ git ]; + TARGET_OS = target-os; + shellHook = '' + set -e - export STATUS_REACT_HOME=$(git rev-parse --show-toplevel) + export LANG="en_US.UTF-8" + export LANGUAGE="en_US.UTF-8" - ${shellAttr.shellHook or ""} + export STATUS_REACT_HOME=$(git rev-parse --show-toplevel) - if [ "$IN_NIX_SHELL" != 'pure' ] && [ ! -f $STATUS_REACT_HOME/.ran-setup ]; then - $STATUS_REACT_HOME/scripts/setup - touch $STATUS_REACT_HOME/.ran-setup - fi + ${super.shellHook or ""} - set +e - ''; - }; - # Declare a specialized mkShell function which adds some bootstrapping - # so that e.g. STATUS_REACT_HOME is automatically available in the shell - mkShell' = shellAttr: - (mkShell.override { inherit stdenv; }) (shell' shellAttr); + if [ "$IN_NIX_SHELL" != 'pure' ] && [ ! -f $STATUS_REACT_HOME/.ran-setup ]; then + $STATUS_REACT_HOME/scripts/setup + touch $STATUS_REACT_HOME/.ran-setup + fi -in mkShell' + set +e + ''; + })