2019-06-04 16:50:29 +00:00
|
|
|
#
|
2019-11-20 12:42:41 +00:00
|
|
|
# This Nix expression appends/modifies an existing attribute set in order to run scripts/setup if needed,
|
2019-06-04 16:50:29 +00:00
|
|
|
# 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
|
|
|
|
2019-11-26 10:24:06 +00:00
|
|
|
# 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
|
2019-06-04 16:50:29 +00:00
|
|
|
|
2019-11-26 10:24:06 +00:00
|
|
|
export LANG="en_US.UTF-8"
|
|
|
|
export LANGUAGE="en_US.UTF-8"
|
2019-06-04 16:50:29 +00:00
|
|
|
|
2019-11-26 10:24:06 +00:00
|
|
|
export STATUS_REACT_HOME=$(git rev-parse --show-toplevel)
|
2019-06-04 16:50:29 +00:00
|
|
|
|
2019-11-26 10:24:06 +00:00
|
|
|
${super.shellHook or ""}
|
2019-06-04 16:50:29 +00:00
|
|
|
|
2019-11-26 10:24:06 +00:00
|
|
|
if [ "$IN_NIX_SHELL" != 'pure' ] && [ ! -f $STATUS_REACT_HOME/.ran-setup ]; then
|
|
|
|
$STATUS_REACT_HOME/scripts/setup
|
|
|
|
touch $STATUS_REACT_HOME/.ran-setup
|
|
|
|
fi
|
2019-06-04 16:50:29 +00:00
|
|
|
|
2019-11-26 10:24:06 +00:00
|
|
|
set +e
|
|
|
|
'';
|
|
|
|
})
|