nix-devcontainer icon indicating copy to clipboard operation
nix-devcontainer copied to clipboard

Cache of /nix only seems to work with docker compose

Open dsyer opened this issue 3 years ago • 2 comments

The example devcontainer.json in the source code use docker compose. It works for me as expected - if I rebuild the container the /nix/store is not downloaded again. If I use the example from the README with "dockerFile": "Dockerfile" etc, then the /nix/store is downloaded on every container startup, even though the same volume is definitely mounted (per docker inspect). Any idea why that is, or what I am doing wrong?

P.S. I love what you did here. I might use a simplified version until I understand what all the moving parts are, but it's all great stuff.

dsyer avatar Aug 26 '22 07:08 dsyer

Did you add VOLUME /nix to your Dockerfile, like it's done here https://github.com/xtruder/nix-devcontainer/blob/main/.devcontainer/Dockerfile#L3? I should probably mention it in README or include it into base Dockerfile. Most likely the reason why I didn't do that was because sometimes you don't want to cache /nix and want fresh nix store on every rebuild, but as long I have been using this devcontainer I have always wanted to cache nix store.

PS: Thank you! If you have some suggestions or questions how different parts work together I am open for questions, I might also need to update some parts of README to make things more understandable.

offlinehacker avatar Aug 26 '22 09:08 offlinehacker

I was using this repo to test and editing only the devcontainer.json. So it has the VOLUME directive for sure.

dsyer avatar Aug 26 '22 18:08 dsyer