nh
nh copied to clipboard
Implement `nh profile`
nix profile
is so bad, potentially could be nh pkg
instead?
Would you be interested in contributions regarding this? I agree that nix profile
is awful and have tried to improve that, but the nix team is focussed on the core right now, so contributions take forever to be reviewed and little progress has been made. Every now and then there is debate about dropping nix profile
entirely, so it's about time that an alternative emerged.
I've been thinking about re-writing nix profile
fully as an external tool. It wouldn't even share the nix-env
logic regarding symlinks and rollbacks with nix itself, as that has flaws as well, see https://github.com/NixOS/nix/issues/311
Ideally, I would like to be able to provide a seamless transition between the imperative interface of install
, remove
, upgrade
and the declarative interface of just editing a Nix file.
The two options would be:
- Add
export
andimport
commands to allow storing the profile as a flake or old-school nix file - Make the "manifest" a fully valid Nix file itself, all imperative commands would just parse, edit and re-create that file
Please let me know you thoughts.
Hey! Thank you very much for the interest!
I have to admit that this issue was in the bottom of my mental stack. As always, one thing leads to another, and I wanted to finish other projects before looking into this.
I also saw that some of the fixes (- I believe around nix 2.20) that are good enough for what I wanted to do with activation-manager, so I also thought nix profile
could be good enough.
I'd gladly accept contributions. (Be advised that nh's codebase is a bit rough around the edges). Adding subcommands is just adding a new enum variant to interface.rs, and implementing NHRunnable
https://github.com/viperML/nh/blob/master/src/interface.rs#L54-L68 . The subcommands are quite "standalone" from nh as a whole.
But is there any reason you would want to implement this in nh, instead of writing your own standalone CLI tool?
My main motivation was discoverability. The ecosystem is very fractured because many tiny tools exist for different purposes, and it takes a long time to find all the useful ones that really make the user journey pleasant.
It seems to me like the idea of nh is to incorporate multiple of those into one interface. Though I guess if that is the case, there would be no harm in me making this separately and integrating it here once it's actually mature enough.
Activation-manager looks like a very cool solution as well, though, I'll check it out!
Though I guess if that is the case, there would be no harm in me making this separately and integrating it here once it's actually mature enough
Feel free to iterate here in nh then! Since your other comment, I've been thinking about that idea of having a mechanism to bridge the imperative world (nix profile
etc), and editing declarative files, and sounds like the way to go.
Activation-manager looks like a very cool solution as well, though, I'll check it out!
Most of what I want for AM is still on my head though, the actual code in the repo doesn't reflect that...