Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nix): Enable persistent volume for shared nix-store #1127

Merged
merged 5 commits into from
Sep 25, 2024

Conversation

max06
Copy link
Contributor

@max06 max06 commented Sep 23, 2024

Closes #284

Enables a shared, persistent docker volume for /nix/store.
Garbage collection is no issue since nix simply refetches everything that's missing. On the other hand this volume will probably save a lot of storage and bandwidth due to deduplication.

My use case: I enabled the nix feature per default for every devcontainer, to be used with my dotfiles-repo (and home-manager).

Alternative: Duplicate feature to have both options, one with cache, one without.


Update

The nix-store volumes are no longer shared with all containers using this feature. Nix (or it's store) does not seem to be ready for shared access. Instead, every devcontainer using this feature gets its own persistent store volume. This reduces the rebuild-times and data transfer, but not as much as a the shared store. Imo, still a useful change.

The diff looks bad, but it's just because I removed one if-else-condition spanning 55 lines.

(Wrong statement about renamed package removed)

@max06 max06 requested a review from a team as a code owner September 23, 2024 10:38
@max06 max06 force-pushed the nix-store-volume branch 2 times, most recently from d52a6da to 260aeae Compare September 25, 2024 14:57
@max06
Copy link
Contributor Author

max06 commented Sep 25, 2024

All tests green - on my machine. Let's hope CI gets the same result 😄

src/nix/devcontainer-feature.json Show resolved Hide resolved
src/nix/devcontainer-feature.json Show resolved Hide resolved
src/nix/devcontainer-feature.json Outdated Show resolved Hide resolved
Copy link
Member

@samruddhikhandale samruddhikhandale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you! ⚡

@samruddhikhandale samruddhikhandale merged commit 302feca into devcontainers:main Sep 25, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nix feature doesn't cache /nix
2 participants