• Stars
    star
    864
  • Rank 52,774 (Top 2 %)
  • Language
    Rust
  • License
    European Union Pu...
  • Created almost 3 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Yet another nix cli helper

dependency status

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-manager
  • Visualization of the upgrade diff with nvd
  • Asking for confirmation before performing activation

build: passing

Installation

Nixpkgs

nh is available in nixpkgs:

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.

{ 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:

{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.

More Repositories

1

wrapper-manager

Post-modern configuration management
Nix
202
star
2

dotfiles

Personal configuration files for my PC
Nix
157
star
3

noshell

User-configurable login shell
C
48
star
4

home-manager-wsl

WSL distribution, including Nix + Home-manager + FHS Distro
Nix
35
star
5

activation-manager

The missing piece for effectful operations with Nix
Nix
29
star
6

miq

Master's thesis - Immutable package management for Linux
Rust
20
star
7

hover-rs

Protective home overlay
Rust
20
star
8

mkshell-minimal

POC of mkShell with the smallest closure possible
Nix
18
star
9

neoinfra

Infrastucture as code
Nix
14
star
10

iosevka

My iosevka build, patched with nerd fonts
Nix
13
star
11

qemu-android-x86

Android-x86 environment via QEMU and VirGL
Shell
6
star
12

neohome

Source for https://ayats.org
Astro
5
star
13

deploy-rs-example

Nix
4
star
14

nixos-discord-bot

Discord bot for the unofficial NixOS discord server.
Python
4
star
15

viperML-overlay

Gentoo’s portage overlay with packages for personal use.
Shell
4
star
16

home

Source for https://ayats.org
Nix
3
star
17

octoprint-nix

NixOS configuration for a raspberry pi with octoprint
Nix
3
star
18

bundlers

Nix
3
star
19

ubuntu-declarative

Shell
3
star
20

Guia-Instalacion-Gentoo

Guía de instalación de Gentoo Linux en español
3
star
21

delphix

Nix
3
star
22

nix-common

Common bits and pieces for NixOS and Home-Manager modules
Nix
2
star
23

sauce-archiver

Haskell
2
star
24

bad-nix

Exploit the capabilities of trusted users in Nix
Nix
2
star
25

bangscript

Embed scripts in a shebang
Rust
2
star
26

gentoo-plasma

Docker image with Gentoo + KDE Plasma
Dockerfile
1
star
27

st

Simple terminal patch set
C
1
star
28

tree-sitter

Everything tree-sitter, at once
Rust
1
star
29

in-nix

Export IN_NIX for subprocesses of Nix
Nix
1
star
30

experiments

All my experiments in one place
Nix
1
star
31

len

Toy language
Rust
1
star
32

splitdigitalclock

Copy of https://store.kde.org/p/1324315
QML
1
star
33

infra

Nix
1
star
34

wrapper-hack

Rust
1
star