In the spirit of getting innocent and unsuspecting souls hooked on portable declarative packgage management, I’m wondering whether it’s possible create a not-too-ugly, self-contained and self-installing
home-manager configuration, in a single file.
The idea is to make the process so simple, that anyone who knows which end of a keyboard to sit at, should be able to follow it. The proverbial grandmother, if you like.
Put another way, I should be able to say to someone, “Save this single file, run this single command, and you will have installed the N packages you want/need/we talked about over coffee”.
nix-shell -p cowsay --run 'cowsay Nix is installed!'works in the victim’s account on the victim’s machine.
- Provide the victim with a SINGLE FILE. (Let’s assume, in what follows, that the victim saves it as
$HOME/the-magic-nix-file, but any reasonable name will do. Maybe even
.config/nixpkgs/home.nix, though a more obviously/sensibly version-controllable location would be preferable.)
- Ask the victim to exectue a SINGLE SHELL COMMAND, that uses
Having completed these two steps, the victim should now have whatever packages were specified in
home.packages inside the file.
Changing the set of installed packages should consist of exactly 2 steps:
- EITHER repeat exactly the same command as was used in part 2
pkgsversion should be pinned.
Can you propose a solution?
I’ve have bootstrapped people with a single directory containing 3 files
If I could reduce this to a single file, I would be able to persuade more people to give it a go, eventually leading them to benefit from the wonders that home-manager has to offer.
I would like the solution to be home-manager based, because there is an easy upgrade path to more involved configurations, for those victims who get hooked.
Alternatively, I would like to be able to answer the question
with something like