Last active
June 9, 2020 20:13
-
-
Save LnL7/ba2eac19e77cd6b4bb02c8de03bf5f4e to your computer and use it in GitHub Desktop.
darwin nix-daemon distributed builds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
sudo mkdir -p /run/nix/current-load | |
sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist | |
sudo rm /Library/LaunchDaemons/org.nixos.nix-daemon.plist | |
sudo curl -fsSL -o /Library/LaunchDaemons/org.nixos.nix-daemon.plist https://gist.github.com/LnL7/ba2eac19e77cd6b4bb02c8de03bf5f4e/raw/69722c2b13c4eb022a1312cd6891838b413e1f96/org.nixos.nix-daemon.plist | |
sudo launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist | |
# Configure /etc/nix/machines | |
# Make sure root can ssh to the builder (known_hosts etc.) | |
# Configure known hosts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mac1 x86_64-darwin /etc/nix/build_rsa 4 | |
mac2 x86_64-darwin /etc/nix/build_rsa 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>EnvironmentVariables</key> | |
<dict> | |
<key>NIX_BUILD_HOOK</key> | |
<string>/nix/var/nix/profiles/default/libexec/nix/build-remote.pl</string> | |
<key>NIX_CURRENT_LOAD</key> | |
<string>/run/nix/current-load</string> | |
<key>NIX_REMOTE_SYSTEMS</key> | |
<string>/etc/nix/machines</string> | |
<key>NIX_SSL_CERT_FILE</key> | |
<string>/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt</string> | |
</dict> | |
<key>KeepAlive</key> | |
<true/> | |
<key>Label</key> | |
<string>org.nixos.nix-daemon</string> | |
<key>LowPriorityIO</key> | |
<false/> | |
<key>Nice</key> | |
<integer>0</integer> | |
<key>ProcessType</key> | |
<string>Interactive</string> | |
<key>Program</key> | |
<string>/nix/var/nix/profiles/default/bin/nix-daemon</string> | |
<key>SoftResourceLimits</key> | |
<dict> | |
<key>NumberOfFiles</key> | |
<integer>4096</integer> | |
</dict> | |
</dict> | |
</plist> |
- Why not store current load under /nix/var/run? Keeps all Nix files under /nix…
- Same for machines, this could go under /nix/etc/machines
None of the nix-daemon environment variables should be necessary anymore with nix 2.0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
These are some issues I've run into when setting it up:
NIX_CURRENT_LOAD
has to exist.WARNING: don't use
nix-build --check
to verify if this is working correctly, it always builds locally.nix-build -E 'with import <nixpkgs> { system = "x86_64-darwin"; }; hello.overrideAttrs (drv: { REBUILD = builtins.currentTime; })'