-
Notifications
You must be signed in to change notification settings - Fork 168
Nix shell changes #3919
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
base: main
Are you sure you want to change the base?
Nix shell changes #3919
Conversation
Summary of ChangesHello @ss-es, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Nix development environment by integrating Docker support and improving Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request improves the Nix shell configuration by adding Docker support for demo-native and correctly ignoring user-specific .envrc files. The changes are logical and well-described. I have one suggestion to make the Docker configuration more robust by applying it conditionally only on Linux, which will prevent issues for developers on other operating systems like macOS.
| # Required for demo-native to run with docker-rootless | ||
| export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This unconditionally sets DOCKER_HOST to the path for rootless Docker on Linux. This will likely break Docker for developers on other operating systems (like macOS) or for those on Linux who are not using a rootless setup. It's better to set this environment variable conditionally, only for Linux systems.
# Required for demo-native to run with docker-rootless on Linux
if [[ "$(uname -s)" == "Linux" ]]; then
export DOCKER_HOST="unix://$XDG_RUNTIME_DIR/docker.sock"
fi
| export CARGO_HOME=$HOME/.cargo-nix | ||
|
|
||
| # Required for demo-native to run with docker-rootless | ||
| export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @sveitser : my understanding was that this shouldn't actually interefere with anyone's existing setup but maybe I'm wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does seem to break things for me
$ export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock
$ docker ps
failed to connect to the docker API at unix:///run/user/1000/docker.sock; check if the path is correct and if the daemon is running: dial unix /run/user/1000/docker.sock: connect: no such file or directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But yeah a rootless docker setup seems much preferrable so let's make it work somehow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh that's unfortunate
maybe the better thing to do then is to just add a separate shell for this? with the .envrc removal it shouldn't make a difference to have it in a non-default shell
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll look into it a bit more but I'll just update with that if I can't find anything
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could just check if the socket exists before setting the env var?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But yeah a rootless docker setup seems much preferrable so let's make it work somehow.
I was only a bit worried about breaking existing workflows
| target/ | ||
|
|
||
| # .envrc typically just has `use flake .` | ||
| # but this should be done by the user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's update the README section concerning the direnv setup then.
dockerto the packages provided by the nix-shell, and setsDOCKER_HOSTin the shell so that one can rundocker-rootlessprovided by the development shell forjust demo-native..envrcand adds the file to.gitignore. I feel like this is fundamentally a personal thing that should never have been committed e.g. I have sometimes wanted to use a different shell from the flake. The existing.envrcis renamed to.envrc.examplefor conveience, so that it's still available for anyone to rename.envrc.example->.envrc