-
Notifications
You must be signed in to change notification settings - Fork 553
Description
Running on linux (nixos), with docker.
Steps to reproduce:
-
Create and start a new environment
{ "name": "test", "image": "mcr.microsoft.com/devcontainers/base:noble", "features": { "ghcr.io/devcontainers/features/nix:1": { "packages": "hello" } } } -
Change
packagesand rebuild{ "name": "test", "image": "mcr.microsoft.com/devcontainers/base:noble", "features": { "ghcr.io/devcontainers/features/nix:1": { "packages": "busybox" } } } -
After rebuild
busyboxwon't be available (or any other package frompackages).
After some debugging I think I found the cause. First time we build and run it, nix-store-* volume is empty, and files are copied into it when an empty volume is mounted. Second time however since volume already contains data, it mounts over existing /nix/store from second build. And so /home/vscode/.nix-profile symlink chain is broken, since the new profile is not in /nix/store.
Furthermore if we change anything that affects nix installation itself, it will likely also be overwritten by volume mount. And I somehow managed to also break nix install completely during debugging, but I wasn't able to reproduce it.
The workaround would be to delete the volume every time devcontainers gets rebuilt, or somehow make volume name unique to specific build of the image, not image name.
To make work with /nix/store in volume, it would have to be mounted during feature install, which I don't think is possible.
Is it possible to make mount point optional (or a separate feature with or without it)?