Crates.io | hdn |
lib.rs | hdn |
version | 1.0.0 |
source | src |
created_at | 2023-05-23 21:08:56.062722 |
updated_at | 2023-05-25 20:23:33.290274 |
description | Utility for updating home.nix |
homepage | |
repository | https://github.com/seasonedfish/hdn |
max_upload_size | |
id | 872339 |
size | 54,026 |
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
:
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:
home-manger
on your PATHhome.nix
lives in one of the default locations (namely, ~/.config/home-manager/
, ~/.config/nixpkgs/
, ~/.nixpkgs/
)home.nix
contains the attribute home.packages
, the list of packages in the user environmentThese requirements should be satisfied with the default home-manager installation.
This program uses Rust, and I don't actually know how to program in Rust.
(I chose Rust because I found a Rust library for easily reading and writing nix files.)
Someday I'll go back, actually learn Rust, and rewrite this, but for now, use at your own risk.
Releases are available on crates.io.
cargo install hdn
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.