Skip to content

Commit

Permalink
fix failing setup via sandbox, fix jupyter extension build
Browse files Browse the repository at this point in the history
- echo 'sandbox = false' | sudo tee /etc/nix/nix.conf
  via NixOS/nix#2651;
- nbextensions build was failing due to libxml2; fix with
  adding python37Packages.lxml to NIX_PYTHON_PACKAGES
  • Loading branch information
alexhrescale committed Mar 26, 2019
1 parent 57d94b8 commit 5675a0b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ else
fi

if [ "x" != "x${PROOT_BINARY}" ]; then
NIX_DIR=$HOME/.nix
CUSTOM_ROOT=$HOME/.nix-root
NIX_DIR=$HOME/.nix-root/nix
NIX_ETC_CONF=$HOME/.nix-root/etc/nix/nix.conf

echo Using proot at $PROOT_BINARY with nix directory in $NIX_DIR
# https://nixos.wiki/wiki/Nix_Installation_Guide#PRoot
Expand All @@ -62,14 +64,18 @@ if [ "x" != "x${PROOT_BINARY}" ]; then

PROOT_RELEASE_URL=https://github.com/proot-me/proot-static-build/releases/download/v5.1.1/proot_5.1.1_x86_64_rc2

PROOT_COMMAND="$PROOT_BINARY -b $NIX_DIR:/nix bash"
PROOT_COMMAND="$PROOT_BINARY -b $NIX_DIR:/nix -b $(dirname $NIX_ETC_CONF):/etc/nix bash"

if [ ! -e $PROOT_BINARY ]; then
wget -O $PROOT_BINARY $PROOT_RELEASE_URL
chmod +x $PROOT_BINARY
fi
if [ ! -e $NIX_DIR ]; then
mkdir $NIX_DIR
mkdir -p $NIX_DIR
fi
if [ ! -e $NIX_ETC_CONF ]; then
mkdir -p $(dirname $NIX_ETC_CONF)
echo 'sandbox = false' > $NIX_ETC_CONF
fi
function run() {
$PROOT_COMMAND "$@"
Expand Down Expand Up @@ -137,7 +143,7 @@ for pfile in .bashrc .bash_profile; do
done
nix-channel --update
NIX_PYTHON_PACKAGES=(python37Full python37Packages.pyzmq python37Packages.pip python37Packages.numpy python37Packages.pandas)
NIX_PYTHON_PACKAGES=(python37Full python37Packages.lxml python37Packages.pyzmq python37Packages.pip python37Packages.numpy python37Packages.pandas)
NIX_PACKAGES=$(cat <<EOF
emacs
firefox
Expand Down Expand Up @@ -206,7 +212,7 @@ jupyter contrib nbextension install --user;
jupyter nbextensions_configurator enable --user;
EOF
)
nix-shell -p $NIX_PYTHON_PACKAGES --run "$CMD"
nix-shell -p ${NIX_PYTHON_PACKAGES[@]} --run "$CMD"
for pfile in .bashrc .bash_profile; do
cat >> ${HOME}/${pfile} <<EOF
Expand Down

0 comments on commit 5675a0b

Please sign in to comment.