Nix feature - #228
Conversation
|
//cc Jonathan Carter (@lostintangent) Geoffrey Huntley (@ghuntley) given previous interest |
|
Dropped the derivation property in favor of flake given you currently can't use a .nix file from the source tree (could be added later once we have postCreateCommand support in features). Also noticed other features seem to be using comma separation for lists so adjusted to match. |
|
Test failures in CI were expected since (as covered by NOTES.md), single-user does not work without doing a chown post-create on Linux when the host's UID updates. So added the chown to the test with a warning. |
|
Samruddhi Khandale (@samruddhikhandale) Also I think I accidently deleted a comment you made when trying to delete a comment I made. 😅 |
Samruddhi Khandale (samruddhikhandale)
left a comment
There was a problem hiding this comment.
Looks awesome. Thank you! 👏 👏
🚀 🚀
|
Can someone help with some more detailed instructions on how to use this? I tried adding the feature and getting a lot of errors. Different errors, no obvious pattern. This one is common: |
|
Dave Syer (@dsyer) Would you mind raising an issue with your specifics? In particular the base image you are using, OS, architecture, etc. Possible there's a scenario where things are not working as expected. That particular error though sounds like its actually having a hard time downloading the feature itself which could be connectivity related. #275 is very specific to the universal image, for example. |
|
That's it really, for the specifics. The JSON is just the default if you add ubuntu and nix. My network connectivity is generally good here locally. Maybe there was a DNS glitch out there somewhere? 185.199.111.154 looks like Github (not gcr.io). |
|
Dave Syer (@dsyer) Raised devcontainers/cli#281 for you. Folks won't reply to a merged PR. |

This PR adds a dev container feature for Nix. It supports using base images from Debian/Ubuntu, the RHEL tree, and Alpine.
I refactored some utilities into a utils.sh file to make the main script more readable.
The feature can just install nix, or install nix and a set of packages, a Flake, or a derivation. This is limited to things in the base image (or remote URIs in the case of Flakes) due to the lack of lifecycle hook support (devcontainers/spec#60). We can update once that is available.
Given Nix is picky about privs, the script supports doing both a single user and multi-user install. NOTES.md includes info on what each does and downsides by scenario.
Given the breadth of the capabilities, there's also a battery of tests which were unblocked by recent tweaks to the devcontainer CLI's testing setup.