Skip to content

Darwin Builder Setup

Daiderd Jordan edited this page Mar 5, 2018 · 7 revisions

Setup a builder using nix-darwin

Since nix-darwin includes a service module for ofborg it's probably the easiest way too setup a builder on macOS. To get started with follow the installer instructions.

First get the ofborg sources, this can be done with a local clone or using a github channel like this.

# Configure ofborg channel.
nix-channel --add https://github.com/NixOS/ofborg/archive/released.tar.gz ofborg
nix-channel --update

Setup the config file, do not use store paths for this. Without sandboxing builds can potentially read the entire store on the host, exposing secrets in the process.

# Setup config
sudo mkdir -p /var/lib/ofborg
sudo $EDITOR /var/lib/ofborg/config.json

There's an example darwin configuration.nix that can be used as a starting point. This includes some useful defaults like automatic garbage collecting. NOTE: Some options like nix.buildCores probably don't have a correct default value, edit those before or during the install process.

# Install nix-darwin.
mkdir ~/.nixpkgs
curl -o ~/.nixpkgs/darwin-configuration.nix https://raw.githubusercontent.com/LnL7/nix-darwin/master/modules/examples/ofborg.nix
nix-shell https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
Clone this wiki locally