Nix
MacOS Example
The following works as of nix version 2.10.3. |
-
Configure nix by modifying and/or adding the following files.
/etc/nix/nix.confbuild-users-group = nixbld sandbox = false experimental-features = nix-command flakes substituters = https://cache.nixos.org s3://nsstatdev-main-usae1-nix-cache https://hydra.iohk.io https://cache.iog.io https://cache.dhall-lang.org https://dhall.cachix.org trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nsstatdev-main-usae1-nix-cache-1:3qt3qqlXhyl2HGK8UE1Eh12NEmoyK8mx81uDWDAKPn4= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.dhall-lang.org:I9/H18WHd60olG5GsIjolp7CtepSgJmM2CsO813VTmM= dhall.cachix.org-1:8laGciue2JBwD49ICFtg+cIF8ddDaW7OFBjDb/dHEAo= post-build-hook = /etc/nix/upload-to-cache.sh max-jobs = auto
/etc/nix/key.privateRequest key on slack on stats-software-dev channel.
/etc/nix/upload-to-cache.shThis is similar to the script that the
nsBuild
nix
docker image uses.#!/bin/sh 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/upload-to-cache.sh
-
Test out nix by running:
nix run nixpkgs#hello
. You should you see:Hello, world!