# Recommendations for introducing a shared nix store or cache for CI/CD and development

**URL:** https://discourse.nixos.org/t/recommendations-for-introducing-a-shared-nix-store-or-cache-for-ci-cd-and-development/15248
**Category:** Help
**Created:** [September 28, 2021, 6:11am UTC](https://discourse.nixos.org/t/recommendations-for-introducing-a-shared-nix-store-or-cache-for-ci-cd-and-development/15248 "2021-09-28T06:11:23Z")
**Posts on this page:** 1
**Showing post:** 13

<div class="post-metadata">

### Author: ![ldeck](https://discourse.nixos.org/user_avatar/discourse.nixos.org/ldeck/32/6391_2.png) [@ldeck](https://discourse.nixos.org/u/ldeck)
#### Post date: [September 30, 2021, 10:52am UTC](https://discourse.nixos.org/t/recommendations-for-introducing-a-shared-nix-store-or-cache-for-ci-cd-and-development/15248/13 "2021-09-30T10:52:09Z")

</div>

Thanks for the suggestion @kamadorueda. That sounds great.

### Motivation / pain points
We were just hoping to save having to download/upload derivations regularly per job, instead of having it mounted and immediately accessible. 

So I realise now there’s a few problems with this:

1. the docker image we’ve used so far (nixos/nix) itself already has a /nix/store. We could potentially look at using layerfs to layer this with a bind mounted /nix/store from the host/network. Perhaps.
2. The docker container (nixos/nix) would maintain its own store db. Persisting this doesn’t sound trivial (with simultaneous read/writes across jobs)

### Bootstrap Container Store?

Perhaps the above could be worked around by creating a docker image that has static nix tools in an alternate location, allowing /nix/store to merely contain fetched/built derivations. But again, the question of a persisted and shared/served nix store with db remains. See @zimbatm’s suggestion on this [here](https://discourse.nixos.org/t/sharing-nix-store-between-containers/9733/13).

### S3 Store Pro/Cons?

So another thing we’ve considered looking at using is a read/write S3 store. _I presume/hope_ this configuration would involve simultaneous read/write options, but again would involve pushing/pulling as required instead of something that’s immediately available at a mount point.

### Longer Term

So longer term I’d want to move to more sophisticated tools like _makes_ as you suggest @kamadorueda.

### Short Term

I’m looking for a quick win. The primary caveat atm is downloading artifacts for each job from [cache.nixos.org](http://cache.nixos.org). That’s pretty quick to be fair, but obviously if we can save the time that’ll save us time.

Something like storing/restoring app paths just for our project / branch?  
Of course, downloading from [cache.nixos.org](http://cache.nixos.org) isn’t the biggest painpoint atm. Just an obvious point of optimisation.

---

_[View the full topic](https://discourse.nixos.org/t/recommendations-for-introducing-a-shared-nix-store-or-cache-for-ci-cd-and-development/15248)._
