2019-06-04 16:50:29 +00:00
|
|
|
#
|
|
|
|
# This Nix expression appends/modifies an existing attribute set in order to run scripts/setup if needed,
|
|
|
|
# as well as define STATUS_REACT_HOME
|
|
|
|
#
|
|
|
|
|
2019-07-19 18:40:03 +00:00
|
|
|
{ stdenv, mkShell, target-os, git }:
|
2019-06-04 16:50:29 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
shell' = shellAttr:
|
|
|
|
shellAttr // {
|
|
|
|
nativeBuildInputs = (shellAttr.nativeBuildInputs or []) ++ [ git ];
|
2019-07-19 18:40:03 +00:00
|
|
|
TARGET_OS = target-os;
|
2019-06-04 16:50:29 +00:00
|
|
|
shellHook = ''
|
|
|
|
set -e
|
|
|
|
|
|
|
|
export STATUS_REACT_HOME=$(git rev-parse --show-toplevel)
|
|
|
|
|
|
|
|
${shellAttr.shellHook or ""}
|
|
|
|
|
|
|
|
if [ "$IN_NIX_SHELL" != 'pure' ] && [ ! -f $STATUS_REACT_HOME/.ran-setup ]; then
|
|
|
|
$STATUS_REACT_HOME/scripts/setup
|
|
|
|
touch $STATUS_REACT_HOME/.ran-setup
|
|
|
|
fi
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
in mkShell'
|