Skip to content

Instantly share code, notes, and snippets.

@puffnfresh
Last active October 28, 2020 03:06
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save puffnfresh/a4a63bc26ead1635e222 to your computer and use it in GitHub Desktop.
Save puffnfresh/a4a63bc26ead1635e222 to your computer and use it in GitHub Desktop.
Installation script for Nix on ChromeOS
#!/bin/sh
sudo mount -o remount,exec /tmp
if [ -x /usr/local/nixstrap/proot-x86_64 ] && [ -h ~/.nix-profile ]; then
echo "Launching shell with nix-* tools!"
exec /usr/local/nixstrap/proot-x86_64 -b /usr/local/nixstrap/nix-1.8-x86_64-linux:/nix bash --init-file ~/.nix-profile/etc/profile.d/nix.sh
fi
set -e
set -x
sudo mkdir -p /usr/local/nixstrap
sudo chown chronos:chronos /usr/local/nixstrap
cd /usr/local/nixstrap
NIX_TAR=nix-1.8-x86_64-linux.tar.bz2
wget -O $NIX_TAR http://hydra.nixos.org/build/17897595/download/1/$NIX_TAR
tar xvf $NIX_TAR
rm $NIX_TAR
wget -O proot-x86_64 http://static.proot.me/proot-x86_64
chmod u+x proot-x86_64
./proot-x86_64 -b nix-1.8-x86_64-linux:/nix /nix/install
set +x
echo "Installation successful."
echo "Run this script again to gain access to the Nix tools."
@jpcookie
Copy link

how about a variant for arm?

@srid
Copy link

srid commented Dec 2, 2018

In the Pixelbook I get:

user@penguin:~$ ./chromebook-nix.sh 
mount: /tmp not mounted or bad option

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
+ sudo mkdir -p /usr/local/nixstrap
+ sudo chown chronos:chronos /usr/local/nixstrap
chown: invalid user: ‘chronos:chronos’

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment