Skip to content

Instantly share code, notes, and snippets.

@virusdave
Forked from puffnfresh/chromebook-nix.sh
Last active June 2, 2019 03:42
Show Gist options
  • Save virusdave/9e5cd93d089f04e5102ae6eae0eb0f5e to your computer and use it in GitHub Desktop.
Save virusdave/9e5cd93d089f04e5102ae6eae0eb0f5e to your computer and use it in GitHub Desktop.
Installation script for Nix on ChromeOS
#!/bin/sh
sudo mount -o remount,exec /tmp
# I was unable to get nix 2.2.2 to install successfully on my chromebook.
NIX_VER=2.1.3
NIX_ID=nix-${NIX_VER}-x86_64-linux
NIX_LOC=/usr/local/nixstrap
if [ -x ${NIX_LOC}/proot-x86_64 ] && [ -h ~/.nix-profile ]; then
echo "Launching shell with nix-* tools!"
exec ${NIX_LOC}/proot-x86_64 -b ${NIX_LOC}/${NIX_ID}:/nix bash --init-file ~/.nix-profile/etc/profile.d/nix.sh
fi
set -ex
sudo mkdir -p $NIX_LOC
sudo chown chronos:chronos $NIX_LOC
cd $NIX_LOC
NIX_TAR=${NIX_ID}.tar.bz2
wget -O $NIX_TAR https://nixos.org/releases/nix/nix-${NIX_VER}/$NIX_TAR
tar xf $NIX_TAR
rm $NIX_TAR
wget -O proot-x86_64 'https://github.com/proot-me/proot-static-build/blob/master/static/proot-x86_64?raw=true'
chmod u+x proot-x86_64
./proot-x86_64 -b ${NIX_ID}:/nix /nix/install --no-daemon
set +x
echo "Installation successful."
echo "Run this script again to gain access to the Nix tools."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment