Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/viperML/nh
Yet another nix cli helper
https://github.com/viperML/nh
cli nix nix-flake nixos rust
Last synced: 3 months ago
JSON representation
Yet another nix cli helper
- Host: GitHub
- URL: https://github.com/viperML/nh
- Owner: viperML
- License: eupl-1.2
- Created: 2022-02-08T19:42:42.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-07-16T17:34:59.000Z (4 months ago)
- Last Synced: 2024-07-16T21:36:54.347Z (4 months ago)
- Topics: cli, nix, nix-flake, nixos, rust
- Language: Rust
- Homepage:
- Size: 484 KB
- Stars: 709
- Watchers: 7
- Forks: 23
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nix - nh - Better output for `nix` `nixos-rebuild` and home-manger CLI using `nvd` and `nix-output-monitor`. (Command-Line Tools / Discovery)
README
[![dependency status](https://deps.rs/repo/github/viperML/nh/status.svg)](https://deps.rs/repo/github/viperML/nh)
nh
Because the name "yet-another-nix-helper" was too long to type...
## What does it do?
NH reimplements some basic nix commands. Adding functionality on top of the existing solutions, like nixos-rebuild, home-manager cli or nix itself.
As the main features:
- Tree of builds with [nix-output-monitor](https://github.com/maralorn/nix-output-monitor)
- Visualization of the upgrade diff with [nvd](https://gitlab.com/khumba/nvd)
- Asking for confirmation before performing activation
## Installation
### Nixpkgs
nh is available in nixpkgs:
- https://search.nixos.org/packages?channel=unstable&query=nh
- Hydra status:
- x86_64-linux: https://hydra.nixos.org/job/nixos/trunk-combined/nixpkgs.nh.x86_64-linux
- aarch64-linux: https://hydra.nixos.org/job/nixos/trunk-combined/nixpkgs.nh.aarch64-linux### NixOS module
The NixOS module has some niceties, like an alternative to `nix.gc.automatic` which also cleans XDG profiles, result and direnv GC roots.
```nix
{ config, pkgs, ... }:
{
programs.nh = {
enable = true;
clean.enable = true;
clean.extraArgs = "--keep-since 4d --keep 3";
flake = "/home/user/my-nixos-config";
};
}
```### FLAKE environment variable
nh uses the `FLAKE` environment variable as the default flake to use for its operations. This can be configured by whichever method you want,
or use the `programs.nh.flake` NixOS option.### Specialisations support
nh is capable of detecting which specialisation you are running, so it runs the proper activation script.
To do so, you need to give nh some information of the spec that is currently running by writing its name to `/etc/specialisation`. The config would look like this:```nix
{config, pkgs, ...}: {
specialisation."foo".configuration = {
environment.etc."specialisation".text = "foo";
# ..rest of config
};specialisation."bar".configuration = {
environment.etc."specialisation".text = "bar";
# ..rest of config
};
}
```## Hacking
Just `nix develop`. We also provide an `.envrc` for direnv.