Following up on what I think the projects/work here are. There are at least two (and maybe more) parts that can be separated if there are enough hands.
This is probably a single project.
I did a proof-of-concept towards this back in late October. It’d need some defrosting, but it may help get started. Here’s the commit where I removed that experiment from my WIP: drop uninstaller code for now · abathur/nix@630a91c · GitHub
It’ll be easier with access to Linux and macOS, but it may not be essential.
I think the bulk of the work should be semi-straightforwardly applying patterns from #4289 to individual artifacts and state changed by the installer.
Shooting from the hip, but AFAIR the patterns address:
- prompting the user (optionally with sudo/password for more-serious changes) for adding/removing something
- showing them the change as needed
- queuing reminders (next steps, notes, etc.) for presentation afterwards
- granular add/remove uses the same work to support both
--uninstall and reinstall (remove, add)
The “harder” problem (and the part that might be splittable?) will be figuring out what to do with/about the single-user install mode (and getting buy-in).
- I think this can wait until the features work in the multi-user installer and it’s possible to demo the experience.
- IIRC the outer installer targets posix sh, while the multi-user installer specifies bash.
This should be easier to split up into more work.
- There are many distinct cases wrt shells people use and what profile/rc files they have present.
- Ideally, the test should cover starting a new shell (without inheriting env) to verify that the shell startup is working correctly.
- This process may also help find conditions that the installer can be testing for and either curing or alerting the user about.
- Populating distinct test-cases should be a fairly shovel-ready contribution to clarifying what does/doesn’t work and avoiding regressions. Issues filed against Nix may be a good resource for detail.
- Install tests currently use install-nix-action, which IIRC limits it to multi-user installs. In order to add single-user test cases, we may need some support in install-nix-action, or a replacement mechanism dedicated to testing?
- The --uninstall/reinstall work above should be able to build on top of the distinct shell/setup cases. There may be some prep work WRT to being able to validate the result of removal/reinstall.