NAME
Niux — A simple CLI tool for managing NixOS packages
SYNOPSIS
https://github.com/sayavc/niux/releasesINFO
DESCRIPTION
A simple CLI tool for managing NixOS packages
README
Niux
English | Русский
Declarative NixOS/home-manager CLI package manager written in Rust. Tired of editing 'configuration.nix' every time you need a package? Niux lets you manage packages with short commands.
Why Niux?
Working with home-manager and NixOS is powerful, but constantly editing configuration files and running switch can feel tedious.
Niux makes it simple and fast: a lightweight CLI that lets you install, remove, and manage packages declaratively with short, intuitive commands — like apt or pacman, but without breaking Nix's declarative philosophy.
- Install with one command (
niux -Hi firefox) - Automatically rebuild configs when needed
- Update flakes, clean up the system, and more
- Built in Rust — fast, reliable, and secure
In short: Niux brings the convenience of traditional package managers to NixOS and home-manager while staying fully declarative.
Features
- 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
How it works
Niux manages your packages by editing your nix config files directly. If markers a incorrect, Niux will tell you
To use it, you do use default markers or add custom:
home.packages = [
# niux-home
firefox
vim
# niux-home-end
];
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
Installation
With flakes (standalone home-manager)
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.
With flakes (module home-manager)
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!
Configuration
First, generate the default config:
niux --gen-config
Or 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-config
To display the path:
niux --show-path
Note: use
--gen-configafter--default-path-configand--default-hook-path-config
Usage
Quick Start
niux -Hi firefox # Install firefox for home niux -Si vim # Install vim for systemniux -Hr firefox # Remove firefox from home
niux -Hl # List home packages niux -l firefox # Search everywhere
niux -U # Update all flakes niux -USHa # Update + rebuild everything
niux -HSa # Rebuild both configs
Installation & Removal
niux -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
Listing & Search
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
Updates
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 system
Build & Apply
niux -Ha # Rebuild home config
niux -Sa # Rebuild system config
niux -HSa # Rebuild both configs
Cleanup
niux --clear # Run nix-collect-garbage
Hooks
Example:
actions {
action "post-rebuild"
run "zsh /etc/niux_post_rebuild.zsh"
}
available actions: install, remove, rebuild, update, list, clear, search
Commands Reference
| Flag | Description |
|---|---|
-H - Home | Target home packages |
-S - System | Target system packages |
-i - install | Install packages |
-r - remove | Remove packages |
-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 |
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
Author
Created by sayavc