Add docker setup
Opened this issue · 3 comments
Hello,
I'm trying to figure out if there's a docker image with this. My background being, that I'm considering to set up a binary cache and because it would be an internal project, I don't want to use cachix. From what I gather, it should be fairly straight-forward to set up and I'm happy to do the work if it doesn't exist yet.
Could you please provide me with some guidance how to go about it in the most fruitful way?
From what I gather, there is no real nixos
docker base image, correct? So the steps I see necessary, it would be:
- start with the
nix
base image - install
nix-serve
- set up
nginx
- manually start
nix-serve
andnginx
inside the container - add the
Dockerfile
to this repo?
A bit of help would be appreciated.
You can build a docker image with nix, which is probably better than using a Dockerfile. However, neither this nor the dockerfile approach will allow you to actually upload paths. You may prefer an nginx serving files from a static folder which you fill using nix copy
.
@lheckemann Could you elaborate on that? I've setup a cache with nix-serve, but I'm concerned about using the host's nix-store for it. Is it possible to have a separate store that is just for the cache?
How can nginx serving static files be a valid cache, is the nix caching mecahnism that simple?
Yes, a binary cache consists of a bunch of .narinfo
files which contain some metadata (including signatures) on paths and .nar
files representing the actual contents of the store paths. You can create one using e.g. nix build nixpkgs.hello && nix copy ./result --to /var/www/nix-cache
and serving /var/www/nix-cache
via nginx or similar.