summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorDomen Kožar <domen@dev.si>2022-12-21 12:20:12 +0000
committerGitHub <noreply@github.com>2022-12-21 12:20:12 +0000
commitbcc8d11f01b7b0471d4a988eab4d18567adf44e4 (patch)
treef627c52a9b149ea34699ee75832e306a3908935f /doc
parente9b218c376891cced33dd2d3b65bbb2be3e73c65 (diff)
parent13bd3271d8e0bd6c9eeac455a9e5a6aaf5e3766e (diff)
Merge pull request #206951 from MercuryTechnologies/gabriella/macos-builder
darwin.builder: init
Diffstat (limited to 'doc')
-rw-r--r--doc/builders/special.xml1
-rw-r--r--doc/builders/special/darwin-builder.section.md60
2 files changed, 61 insertions, 0 deletions
diff --git a/doc/builders/special.xml b/doc/builders/special.xml
index 8902ce5c81329..525eb71abfe7e 100644
--- a/doc/builders/special.xml
+++ b/doc/builders/special.xml
@@ -7,4 +7,5 @@
  </para>
  <xi:include href="special/fhs-environments.section.xml" />
  <xi:include href="special/mkshell.section.xml" />
+ <xi:include href="special/darwin-builder.section.xml" />
 </chapter>
diff --git a/doc/builders/special/darwin-builder.section.md b/doc/builders/special/darwin-builder.section.md
new file mode 100644
index 0000000000000..96b1fcb507f25
--- /dev/null
+++ b/doc/builders/special/darwin-builder.section.md
@@ -0,0 +1,60 @@
+# darwin.builder {#sec-darwin-builder}
+
+`darwin.builder` provides a way to bootstrap a Linux builder on a macOS machine.
+
+This requires macOS version 12.4 or later.
+
+This also requires that port 22 on your machine is free (since Nix does not
+permit specifying a non-default SSH port for builders).
+
+You will also need to be a trusted user for your Nix installation.  In other
+words, your `/etc/nix/nix.conf` should have something like:
+
+```
+extra-trusted-users = <your username goes here>
+```
+
+To launch the builder, run the following flake:
+
+```ShellSession
+$ nix run nixpkgs#darwin.builder
+```
+
+That will prompt you to enter your `sudo` password:
+
+```
++ sudo --reset-timestamp /nix/store/…-install-credentials.sh ./keys
+Password:
+```
+
+… so that it can install a private key used to `ssh` into the build server.
+After that the script will launch the virtual machine:
+
+```
+<<< Welcome to NixOS 22.11.20220901.1bd8d11 (aarch64) - ttyAMA0 >>>
+
+Run 'nixos-help' for the NixOS manual.
+
+nixos login:
+```
+
+> Note: When you need to stop the VM, type `Ctrl`-`a` + `c` to open the `qemu`
+> prompt and then type `quit` followed by `Enter`
+
+To delegate builds to the remote builder, add the following options to your
+`nix.conf` file:
+
+```
+# - Replace ${ARCH} with either aarch64 or x86_64 to match your host machine
+# - Replace ${MAX_JOBS} with the maximum number of builds (pick 4 if you're not sure)
+builders = ssh-ng://builder@localhost ${ARCH}-linux /etc/nix/builder_ed25519 ${MAX_JOBS} - - - c3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSUpCV2N4Yi9CbGFxdDFhdU90RStGOFFVV3JVb3RpQzVxQkorVXVFV2RWQ2Igcm9vdEBuaXhvcwo='
+
+# Not strictly necessary, but this will reduce your disk utilization
+builders-use-substitutes = true
+```
+
+… and then restart your Nix daemon to apply the change:
+
+```ShellSession
+$ sudo launchctl kickstart -k system/org.nixos.nix-daemon
+```