-
Notifications
You must be signed in to change notification settings - Fork 348
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
support nix environments #1302
Comments
this is definitely something I could use a hand with if someone wanted to contribute. I don't use nix or understand it that well. I can help out with the rtx side of this if someone else could basically just make a script that exported the proper env vars (as of right now it isn't possible to do the |
Some doubt about how
|
I feel like https://nix.dev/manual/nix/2.18/command-ref/new-cli/nix3-run.html#apps could be used to solve this, but I need to spend some time tinkering before I have a proposal for precisely how.
I'll also take a look at how mise integrates with poetry. I've got homework to do. I'll be back.... |
A robust interface would at least allow specifying which attribute you want from the Nix expression, and what to do with that. Is it supposed to merely be a tree with stuff in it (such as the output of |
This isn't particularly robust, but I'm using this solution at the moment to automatically activate the flake dev-env, including some logic to prevent repeatedly regenerating the dev-env which can be quite expensive.
The only issue for me is that it doesn't appear to be possible to set function _fix_nix_mise {
if [[ -v IN_NIX_SHELL ]]; then
if [[ -v _NIX_MISE_PATH ]]; then
_NIX_MISE_OLD_PATH=${PATH}
PATH=${_NIX_MISE_PATH}
unset _NIX_MISE_PATH
fi
else
if [[ -v _NIX_MISE_OLD_PATH ]]; then
PATH=${_NIX_MISE_OLD_PATH}
unset _NIX_MISE_OLD_PATH
fi
fi
}
add-zsh-hook precmd _fix_nix_mise |
I think ideally this logic would live in a plugin. We don't currently have support for plugins to create There's some prior art we could leverage with the internal Lines 447 to 451 in 0f290f0
Presumably we could use this inside of |
My attempt at creating a plugin here: which works with a [tools]
nix = { version = "latest" } I wasn't sure what to do about "installing" Also, I tried to get the |
@joshbode Nix maintainer here. What exactly is |
Yeah this is the workaround you need since we don't have support for non-tool plugins like this. I don't think that would be hard to add though.
I think there is an internal config for plugins somewhere that can disable caching entirely if that would be better. Though I agree it should be using the timestamp of those files. |
@fricklerhandwerk it's purely a placeholder to get around the (current) requirement in Mise that tools plugins install a version of something, so the As pointed out, this would probably be better as a plugin targeting Either way, we could definitely add an option to target a specific flake output attribute (rather than defaulting to |
I've done some work to get env-only plugins: #2832 |
It could do with some polish, but I've got a version of Basically, a [env]
_.nix = {} This isn't in the plugin registry yet, so to try it out use:
See https://github.com/joshbode/mise-nix/tree/main/test for a basic example. If anyone has any feedback, please let me know! Note: there's a slightly annoying log message printed before each prompt line which should go away in a new release soon (see: jdx/vfox.rs/pull/50) |
[env]
_.nix = { } that's a little weird but I know why it's like that, maybe we could make this work instead? [env]
_.nix = true |
Good idea, @jdx - it works either way now :) |
Let me know if you have any feedback on the design here btw. I chose to do this via vfox instead of asdf since that allows windows support (of course, not useful for nix). I haven't tested but I also suspect lua is probably a lot faster than bash too. |
It's been pretty good! I think you're right about the performance - it seems faster.
A few of comments:
Overall, it's been nice, though - I think this is a good move.
|
I've removed the loading of functions and non-exported variables - something changed in the latest version of mise (perhaps the I don't think they're of much use anyway (mostly nix-internal build-stage related variables and helper-functions) and if they're really needed then |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
we should have similar support to direnv's
use nix
feature. Perhaps something like this:I noticed https://github.com/nix-community/nix-direnv but only briefly glanced at it. Might be worth seeing if I can port similar performance considerations.
The text was updated successfully, but these errors were encountered: