Skip to content

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

Merged
Samruddhi Khandale (samruddhikhandale) merged 5 commits into
devcontainers:mainfrom
max06:nix-store-volume
Sep 25, 2024
Merged

feat(nix): Enable persistent volume for shared nix-store#1127
Samruddhi Khandale (samruddhikhandale) merged 5 commits into
devcontainers:mainfrom
max06:nix-store-volume

Conversation

@max06

@max06 Flo (max06) commented Sep 23, 2024

Copy link
Copy Markdown
Contributor

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
Flo (max06) requested a review from a team as a code owner September 23, 2024 10:38
Comment thread src/nix/devcontainer-feature.json
@max06
Flo (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
Copy Markdown
Contributor Author

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

Comment thread src/nix/devcontainer-feature.json
Comment thread src/nix/devcontainer-feature.json
Comment thread src/nix/devcontainer-feature.json Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great, thank you! ⚡

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