devenv icon indicating copy to clipboard operation
devenv copied to clipboard

Share nix store with devenv devcontainer?

Open THOUSAND-SKY opened this issue 1 year ago • 2 comments

I was trying out the the .devcontainer.json interop, and am wondering if sharing the host nix store is possible. It would save some bandwidth/disk space (and, most important, time!), and using the devenv devcontainer as base for all my projects would be cool.

THOUSAND-SKY avatar Nov 16 '23 11:11 THOUSAND-SKY

Does devcontainer support mounting? If so, yes :)

domenkozar avatar Mar 07 '24 03:03 domenkozar

Yep, devcontainers should support mounting.

I've made some progress wrt mounting the store:

$ docker run  --entrypoint bash --mount='source=/nix,target=/nix,readonly,type=bind' -e 'NIX_REMOTE=daemon' --rm -ti ghcr.io/cachix/devenv:latest

Seems to work properly, but not clear to me if I'm risking breaking things. Didn't yet plug that into the .devcontainer.json, will be trying that once I have time to tinker again.

THOUSAND-SKY avatar Mar 09 '24 03:03 THOUSAND-SKY