Caching root directory /nix not working

caching
cache

#1

I’m trying to cache a root directory /nix/store to speed up our builds. However, I notice that the directory is not being restored.

Here is the snippet from circle.yml

machine:
  services:
    - rabbitmq-server
    - docker
    - redis

dependencies:
  cache_directories:
    - "~/.cache"
    - "/nix"

  pre:
    - mkdir -p ~/.cache || true
    - mkdir -p ~/.nix || true    
    - |
      [[ -d /nix ]] || sudo mkdir -m 0755 /nix
    - sudo chown ubuntu /nix
    - bash <(curl https://nixos.org/nix/install)
    - echo "source ~/.nix-profile/etc/profile.d/nix.sh" >> ~/.circlerc

  override:
    - scripts/build

#2

Specifically, the restore step fails and the build is automatically retried without cache. Nix package manager stores all dependencies in /nix/store. So in some cases the size of the directory could be around 50 GB. If this exceeds the limits, is there an alternative way to achieve this instead of using CircleCI cache.


#3