-
Notifications
You must be signed in to change notification settings - Fork 355
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
shell: use naked shell concept with env var prepends for leaner shell with autocompletion #191
Conversation
…-shell"" This reverts commit 001c615.
This way pkgs dependencies compile with most low-level toolchains. By patching XDG_DATA_DIRS, shell completions are picked up for installed packages.
@thenonameguy That does not solve my problem. I need a fixed PATH that never changes. So I can say in the IDE this is my Binary and does not have to touch it again. The given path is nix store and changes 😢 |
I see. 😞
I would favor option 2 atm, as it allows for greater extensibility for those products in the future. |
I have no problem to do that in my own project, but you have this problem any GUI software as the PATH is only altered in the shell and not in the OS |
For these kind of use-cases we usually use: Or any other |
Thanks for all this hard work, this looks like a good step forward! How would we address for example PYTHONPATH using this change? Or any language setup-hook that would work currently? |
Thanks @domenkozar ! I would add those to language-specific modules.
I understand your worry, but do not share it.
I would want to reiterate that A good example is the The above showcases that the status quo has it's own faults and needs custom code anyway. Lorri also does this naked shell approach and seem to achieve some better out-of-the-box experience by relying on a few nix fns: This should cover a few more of the top10 languages. I would be interested to do this as a follow-up PR. |
@domenkozar what would you consider necessary to get this merged? I was thinking along the lines of making more elaborate examples for the top 10 most loved languages: Process being:
This would serve multiple purposes:
How does that plan sound? We could ask the language module maintainers to do this (I happily volunteer for Clojure). This was my original goal for: NixOS/nix.dev#367 (just using |
Thanks for all this awesome work - I want to do a bit of testing - hoping to get a chance on Monday! |
This is excellent! Would you do it as part of this PR? |
Also relevant is #209 |
Only if you deem it so that it is required for merging. I'll clarify that this is a breaking change if it ever gets merged. If you deem it necessary to showcase that we are not breaking devenv users too badly, I can do a realworld project transform to devenv using a $LANG selected by you. |
Could you handle Ruby and Rust? Those two are most popular. @shyim can you check that PHP works with this PR? |
Here is the Rust example, had to extend the postgres module to be on par with the Postgres Docker image: I decided to use Nix Flake + nix-direnv as it has superior caching so I get my profile's binaries instantly, when not running devenv commands. Having a second hidden flake via |
@@ -3525,7 +3525,7 @@ attribute set of attribute set of (INI atom (null, bool, int, float or string) o | |||
|
|||
|
|||
## services.postgres.createDatabase | |||
Create a database named like current user on startup. | |||
Create a database named like current user on startup. Only applies when initialDatabases is an empty list. |
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.
Maybe makes more sense to remove it and the user migrates to the new option :)
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 did not want to break the current users of this flag.
Also there is no way of specifying at the moment that $USER
with a program fallback should be used with the initialDatabases
syntax. The name is static at Nix eval time.
In my personal projects I almost always have a static database name locally, so it can be hard-coded for maximum ease of use. This way we don't have to pass the $USER
everywhere.
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.
If it makes sense to deprecate a flag you can do it like:
imports = [
(lib.mkRenamedOptionModule [ "postgres" "enable" ] [ "services" "postgres" "enable" ])
];
I made the Ruby example without flakes. This one uses by default a transient sqlite database, so the devenv.nix is really small. Nokogiri was installed successfully using native extensions (with the updated dependencies) 🎉 |
@@ -1 +1,4 @@ | |||
use flake --impure | |||
# https://github.com/nix-community/nix-direnv | |||
nix_direnv_watch_file devenv.nix |
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.
What happens if the user doesn't have nix-direnv installed?
@thenonameguy added a few nitpicks, other than that we're good to go here! I'll merge it after devenv 0.5 will be released, hopefully tomorrow. |
@domenkozar thanks for the review and the great pointers! I addressed all of them and updated both Both work well, see for yourself. |
Nice work 🚀 I see that in the examples you're using nix flakes interface instead of devenv.nix. Is that a personal preference or is there something that plain devenv doesn't support? |
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.
Almost there :)
@@ -3525,7 +3525,7 @@ attribute set of attribute set of (INI atom (null, bool, int, float or string) o | |||
|
|||
|
|||
## services.postgres.createDatabase | |||
Create a database named like current user on startup. | |||
Create a database named like current user on startup. Only applies when initialDatabases is an empty list. |
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.
If it makes sense to deprecate a flag you can do it like:
imports = [
(lib.mkRenamedOptionModule [ "postgres" "enable" ] [ "services" "postgres" "enable" ])
];
It's a mix of both. There is no way at the moment to easily package the project with Nix for advanced Nix users. For this you still have to use Flakes. I did not do the build packaging for that project though. |
fixes #79
closes #175