MacOS Example

The following works as of nix version 2.10.3.
  1. Install the nix package manager.

  2. Configure nix by modifying and/or adding the following files.

    build-users-group = nixbld
    sandbox = false
    experimental-features = nix-command flakes
    substituters = s3://nsstatdev-main-usae1-nix-cache 
    trusted-public-keys = nsstatdev-main-usae1-nix-cache-1:3qt3qqlXhyl2HGK8UE1Eh12NEmoyK8mx81uDWDAKPn4=
    post-build-hook = /etc/nix/
    max-jobs = auto

    Request key on slack on stats-software-dev channel.


    This is similar to the script that the nsBuild nix docker image uses.

    set -eu
    set -f # disable globbing
    export IFS=' '
    nix store sign --key-file /etc/nix/key.private $OUT_PATHS
    echo "Uploading paths" $OUT_PATHS
    exec nix copy --to 's3://nsstatdev-main-usae1-nix-cache' $OUT_PATHS

    Set this script to executable:

    chmod +x /etc/nix/
  3. Test out nix by running: nix run nixpkgs#hello. You should you see:

    Hello, world!