About

Quick note about the needed bits to get remote building for Nix into a working state on OSX.

Details

The following environment variables are set to hook everything together, so that Nix knows where to build stuff:

export NIX_BUILD_HOOK=~/.nix-profile/libexec/nix/build-remote.pl
export NIX_REMOTE_SYSTEMS=~/etc/nix/remote-systems.conf
export NIX_CURRENT_LOAD=~/tmp/nix-load

To trigger a Linux build, the following command can be used if the derivation allows for an input argument called pkgs:

nix-build --arg pkgs '(import <nixpkgs> { system="x86_64-linux"; })'

Which I ended up putting into the following utility function:

function nix_build_linux() {
    nix-build \
        --arg pkgs '(import <nixpkgs> { system="x86_64-linux"; })' \
        $@
}

export -f nix_build_linux

So often it then boils down into the following:

nix_build_linux release.nix -A build

Note

Initially I used nix-build-linux as the function name. It did turn out that this does work in bash, but it does fail in sh. So I did adapt the name to use underscores instead.


Comments

comments powered by Disqus