Simple one-off script to download and install Nix and NixOps and make it to prepare it for deployments on Mac. Inspired by these instructions.
The script executes the following steps:
- Create a disk image with a case-sensitive file system and mount it at
/nix
. - Install Nix and append environment variable setup to
~/.profile
- Install NixOps
- No Nix installed yet, clean system (Nix-wise)
- XCode command line tools installed (make, gcc etc.)
- Virtualbox (for deployments to VirtualBox)
- Git installed: http://git-scm.com/download/mac
First, configure VirtualBox (source):
- Start VirtualBox.
- Go to preferences (Cmd-,).
- Click on Network.
- If vboxnet0 is not present, add it by clicking the green +.
- Edit vboxnet0 and make sure DHCP Server is turned on. The settings I use are below.
- Server Address: 192.168.56.100
- Server Mask: 255.255.255.0
- Lower Address Bound: 192.168.56.101
- Upper Address Bound: 192.168.56.254
Then, check out this repository in a terminal and run the install script:
git clone git://github.com/zefhemel/nixos-mac-setup.git
cd nixos-mac-setup
./install.sh
To test:
nixops create test/trivial.nix test/trivial-vbox.nix --name test
nixops deploy -d test
After you reboot the NixStore.dmg
will not automatically be remounted to mount it again, run ./attach-disk.sh
again.
By default the NixStore.dmg file is 10G which should be enough for a while, if you want resize it, play with these commands:
hdiutil detach /nix
hdiutil resize -size 50g NixStore.dmg
hdiutil attach NixStore.dmg -mountpoint /nix