Home Manager is great,
but it's tedious to run home-manager edit
,
add your package to the file,
and run home-manager switch
every time you want to install a package.
I wanted a workflow like Poetry,
where I could just add a package and install it in one command.
So, I made hdn
.
You can call it with e.g. hdn add pkgs.hello pkgs.cowsay
:
![image](https://private-user-images.githubusercontent.com/29507110/241032019-0a6fa19b-34c0-4246-9d4e-41b114927d13.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYwNjAwNzcsIm5iZiI6MTcyNjA1OTc3NywicGF0aCI6Ii8yOTUwNzExMC8yNDEwMzIwMTktMGE2ZmExOWItMzRjMC00MjQ2LTlkNGUtNDFiMTE0OTI3ZDEzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTExVDEzMDI1N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ4NTcwZmZlMmMwZTRmMGZlYTI0ZDY5N2UwYjFiMzBhMmUyYjVhNDUxNThlYTkzZjU5MDY1Y2RhNTg2NmY2N2MmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.cjHS61wEcRuJ-nDFchpbseLaPjHNjH32CK_9bKyzC2c)
This adds pkgs.hello
and pkgs.cowsay
to the home.packages
attribute in home.nix
, and calls home-manager switch
.
If home-manager switch
fails, it will automatically roll back home.nix
to its original state.
This program requires that:
- you have
home-manger
on your PATH home.nix
lives in one of the default locations (namely,~/.config/home-manager/
,~/.config/nixpkgs/
,~/.nixpkgs/
)home.nix
contains the attributehome.packages
, the list of packages in the user environment
These requirements should be satisfied with the default home-manager installation.
Releases are available on crates.io.
cargo install hdn
If you don't want to use cargo
to build from source,
you can download a pre-built binary from the Releases page (untested!).
This project was made possible by the work of others (that I stole legally incorporated).
I thank Victor Fuentes for his work on nix-editor; the code for nix parsing and writing comes from his project.
I thank Armin Ronacher for his work on similar;
the code that displays the home.nix
diff comes from his project.