Replies: 17 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 |
Beta Was this translation helpful? Give feedback.
-
Some doubt about how
|
Beta Was this translation helpful? Give feedback.
-
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.... |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
@joshbode Nix maintainer here. What exactly is |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
@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 |
Beta Was this translation helpful? Give feedback.
-
I've done some work to get env-only plugins: #2832 |
Beta Was this translation helpful? Give feedback.
-
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) |
Beta Was this translation helpful? Give feedback.
-
[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 |
Beta Was this translation helpful? Give feedback.
-
Good idea, @jdx - it works either way now :) |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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.
|
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
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.
Beta Was this translation helpful? Give feedback.
All reactions