diff --git a/docs/install.md b/docs/install.md index c13ccfa..ef496a2 100644 --- a/docs/install.md +++ b/docs/install.md @@ -6,7 +6,10 @@ Have a look at the options in the [NixOps manual](https://nixos.org/nixops/manua # Tutorials 1. [Install and configure NixOS for nix-bitcoin on VirtualBox](#tutorial-install-and-configure-nixos-for-nix-bitcoin-on-virtualbox) -2. [Install and configure NixOS for nix-bitcoin on your own hardware](#tutorial-install-and-configure-nixos-for-nix-bitcoin-on-your-own-hardware) +2. [Install and configure NixOS for nix-bitcoin on VirtualBox (macOS host)](#tutorial-install-and-configure-nixos-for-nix-bitcoin-on-virtualbox-macOS-host) +3. [Install and configure NixOS for nix-bitcoin on your own hardware](#tutorial-install-and-configure-nixos-for-nix-bitcoin-on-your-own-hardware) + +---- Tutorial: install and configure NixOS for nix-bitcoin on VirtualBox --- @@ -121,7 +124,7 @@ You can also build Nix from source by following the instructions at https://nixo ./contrib/vbox-resize-disk1.sh ``` - NixOps provides a virtualbox disk thats 50gb in size, but we need more than that to house the Bitcoin blockchain. By default, his script will resize the disk to 300gb. Run it with `-h` to see options. Make sure to run this from within your nix-shell. + NixOps provides a virtualbox disk thats 50gb in size, but we need more than that to house the Bitcoin blockchain. By default, this script will resize the disk to 300gb. Run it with `-h` to see options. Make sure to run this from within your nix-shell. 7. Nixops automatically creates an ssh key for use with `nixops ssh`. Access `bitcoin-node` through ssh in nix-shell with @@ -131,6 +134,54 @@ You can also build Nix from source by following the instructions at https://nixo See [usage.md](usage.md) for usage instructions, such as how to update. +---- + +Tutorial: install and configure NixOS for nix-bitcoin on VirtualBox (macOS host) +--- +## 1. VirtualBox installation (macOS) +The following steps are meant to be run on the machine you deploy from, not the machine you deploy to. + +1. Download and install VirtualBox + Use the official Downloads page: [https://www.virtualbox.org/wiki/Downloads](https://www.virtualbox.org/wiki/Downloads) + + Make sure that the installer you download shows a lock icon in the top right corner to make sure it is signed by Oracle. + +2. Create Host Adapter in VirtualBox + + ``` + vboxmanage hostonlyif create + ``` + +## 2. Nix installation (macOS) + +Follow the instructions from [Nix installation on debian](#2-nix-installation). You will may need to replace `gpg2` with `gpg`. + +## 3. LinuxKit Nix installation +In order to build binaries for your linux (NixOS) virtual machine on a macOS host machine, you need to use [linuxkit-nix](https://github.com/nix-community/linuxkit-nix). It uses hyperkit to spin up a separate VM on which it builds binaries. An alternative solution is [nix-docker-build-slave](https://github.com/LnL7/nix-docker/blob/master/start-docker-nix-build-slave). + +1. Installation + + ``` + nix-env -i /nix/store/jgq3savsyyrpsxvjlrz41nx09z7r0lch-linuxkit-builder + nix-linuxkit-configure + ``` + + You may want to use `nix-linuxkit-configure -c 4` to give the builder 4 CPUs. + +2. Confirm that nix-linuxkit works + + ``` + nix-build /Users/lev/.cache/nix-linuxkit-builder/example.nix + ``` + + As the installer says, run a `nix-build` to make sure that you are able to build linux binaries. The `example.nix` is specifically configured to force a x86_64-linux build. Remove the generated `result` folder afterwards. + +## 4. Nixops deployment (macOS) + +Follow the instructions from [Nixops deployment on debian](#3-nixops-deployment). Add `--option system x86_64-linux` to the `nixops deploy` command in step 5 to force your system to use linuxkit-nix. + +---- + Tutorial: install and configure NixOS for nix-bitcoin on your own hardware ---