CircleCI¶
Create new binary cache on https://app.cachix.org and generate a signing key
Replace
mycache
in following.circleci/config.yml
:
version: 2.1
workflows:
version: 2
workflow:
jobs:
- build
jobs:
build:
docker:
- image: nixos/nix:latest
environment:
CACHIX_NAME: mycache
steps:
- checkout
- run:
name: Set up Cachix
command: |
nix-env -iA nixpkgs.cachix nixpkgs.bash
cachix use $CACHIX_NAME
nix path-info --all > /tmp/store-path-pre-build
- run: nix-build
- run: nix-shell --run "echo nix-shell successfully entered"
- run:
name: Push to Cachix
command: |
bash -c "comm -13 <(sort /tmp/store-path-pre-build | grep -v '\.drv$') <(nix path-info --all | grep -v '\.drv$' | sort) | cachix push $CACHIX_NAME"
Follow circleci documentation to setup environment variable using
$CACHIX_SIGNING_KEY
.If you’re using a private cache, export
$CACHIX_AUTH_TOKEN
and callcachix authtoken $CACHIX_AUTH_TOKEN` just before ``cachix use
.