Note
"1000+ lines of Rust code that could be effectively replaced by a single shell script." — An awesome-nix maintainer
Managing home-manager and NixOS packages manually requires opening configuration files, adding entries to package lists, and executing rebuild commands.
Niux automates this workflow by providing a lightweight CLI to install, remove, and manage packages via short, intuitive commands — similar to traditional package managers like apt or pacman — while strictly preserving Nix's declarative nature.
- Manage packages with a single command (e.g.,
niux -Hi firefox) - Automate configuration rebuilds immediately after modifications
- Update flakes, clean system generations, and manage environment states
- Leverage native Rust performance for safe, fast, and resource-efficient execution
In short: Niux brings the convenience of traditional package managers to NixOS and home-manager while staying fully declarative.
- Fast and lightweight command-line interface
- Manage home and system packages declaratively
- Built with Rust for performance and reliability
- Simple and intuitive command syntax
- Supports both standalone and module home-manager
- Supports NixOS with and without flakes
- Hooks which allow to automate actions
- Autocompletion like Pacman and apt
- Built-in generation diffing powered by
nvdintegration
Niux manages your packages by editing your nix config files directly. If markers are incorrect, Niux will tell you
To get started use default markers or add custom:
home.packages = [
# niux-home
firefox
vim
# niux-home-end
];Also, you can omit the start marker:
home.packages = [
firefox
vim
#end
];
In that case home.packages = [ will be used as start marker
When you run niux -Hi firefox, it inserts the package after the start marker.
When you run niux -Hr firefox, it removes it — but only between the markers, so the rest of your config is never touched.
Markers are configurable via your config
Add to your flake.nix inputs:
inputs.niux = {
url = "github:sayavc/niux";
inputs.nixpkgs.follows = "nixpkgs";
};Pass niux to home-manager via extraSpecialArgs:
outputs = inputs@{ nixpkgs, home-manager, niux, ... }: {
homeConfigurations.youruser = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = { inputs = { inherit niux; }; };
modules = [ ./home/home.nix ];
};
};Then add to your home.nix:
{ inputs, pkgs, ... }: {
home.packages = [
inputs.niux.packages.${pkgs.system}.default
];
}Run home-manager switch to apply.
Add to your flake.nix inputs:
inputs.niux = {
url = "github:sayavc/niux";
inputs.nixpkgs.follows = "nixpkgs";
};Pass niux to home-manager:
outputs = inputs@{ self, nixpkgs, home-manager, niux, ... }: {
nixosConfigurations.yourhostname = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inputs = { inherit niux; }; };
home-manager.users.yourusername = import ./home.nix;
}
];
};
};Add to home.nix:
# home.nix
{ inputs, pkgs, ... }: {
home.packages = [
inputs.niux.packages.${pkgs.system}.default
];
}Note: Non-flake installation docs coming soon, Contributions welcome!
First, generate the default config:
niux --gen-configOr at a custom path:
niux --config /my/path/niux.kdl
niux --gen-config and for hooks:
niux --hook-config /my/path/niux.kdl
niux --gen-configTo display the path:
niux --show-pathNote: use
--gen-configafter--configand--hook-config
niux -Hi firefox # Install firefox for home
niux -Si vim # Install vim for system
niux -Hia firefox # Install firefox for home and rebuild system
niux -Hr firefox # Remove firefox from home
niux -He # Edit packages mode
niux -Hl # List home packages
niux -l firefox # Search everywhere
niux -U # Update all flakes
niux -USHa # Update + rebuild everything
niux -HSa # Rebuild both configsniux -Hi firefox # Install firefox for home
niux -Hia firefox # Install and rebuild home
niux -Si vim # Install vim for system
niux -Sia vim # Install and rebuild system
niux -Hi firefox vim # Install multiple packages for home
niux -Si firefox vim # Install multiple packages for system
niux -Hr firefox # Remove firefox from home
niux -Hra firefox # Remove and rebuild home
niux -Sr vim # Remove vim from system
niux -Sra vim # Remove and rebuild system
niux -Hr firefox vim # Remove multiple from home
niux -Sr firefox vim # Remove multiple from system
niux -He # Edit home packages
niux -Se # Edit system packages
niux -Sea # Edit system packages and rebuild config
niux -Hea # Edit home packages and rebuild config niux -l # List all packages
niux -Hl # List home packages
niux -Sl # List system packages
niux -l firefox # Search everywhere
niux -Hl firefox # Search in home
niux -Sl firefox # Search in system
niux -l firefox vim # Search multiple
niux --search firefox # Search from nixpkgs niux -U # Update all flakes
niux -U nixpkgs # Update specific flake input
niux -HUa # Update + rebuild home
niux -SUa # Update + rebuild system
niux -USHa # Update + rebuild everything
niux -HUa nixpkgs # Update nixpkgs + rebuild home
niux -SUa nixpkgs # Update nixpkgs + rebuild systemniux -Ha # Rebuild home config
niux -Sa # Rebuild system config
niux -HSa # Rebuild both configsniux --clear # Run nix-collect-garbageExample:
actions {
action "post-rebuild"
run "zsh /etc/niux_post_rebuild.zsh"
}available actions: install, remove, edit, rebuild, update, list, clear, search
| Flag | Description |
|---|---|
-H - Home |
Target home packages |
-S - System |
Target system packages |
-i - install |
Install packages |
-r - remove |
Remove packages |
-e - edit |
Edit mode |
-a - apply(rebuild) |
Apply and rebuild configuration |
-l - list |
List or search packages |
-U - Update |
Update flakes |
--gen-config |
Generate default configuration |
--config |
Use custom config path |
--hook-config |
Use custom hook config path |
--show-path |
Get config paths |
--clear |
Run garbage collection |
--search |
Search packages from nixpkgs |
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
Created by sayavc