GitLab CI

  1. Create new binary cache on https://app.cachix.org and generate a signing key

  2. Replace mycache occourances in following .gitlab-ci.yml:

image: nixos/nix:latest

build:
  before_script:
    - nix-env -iA nixpkgs.cachix nixpkgs.bash
    - cachix use mycache
    - nix path-info --all > /tmp/store-path-pre-build
  script:
    - nix-build default.nix
  after_script:
    # push all store paths that were added during the build
    - bash -c "comm -13 <(sort /tmp/store-path-pre-build | grep -v '\.drv$') <(nix path-info --all | grep -v '\.drv$' | sort) | cachix push mycache"
  1. Follow variables configuration tutorial to export $CACHIX_SIGNING_KEY and (needed if the cache is private).

  2. If you’re using a private cache, export $CACHIX_AUTH_TOKEN and call cachix authtoken $CACHIX_AUTH_TOKEN` just before ``cachix use.