{"id":26774456,"url":"https://github.com/nix-community/nh","last_synced_at":"2025-05-14T15:10:56.480Z","repository":{"id":62700285,"uuid":"457079050","full_name":"nix-community/nh","owner":"nix-community","description":"Yet another nix cli helper","archived":false,"fork":false,"pushed_at":"2025-04-03T12:23:19.000Z","size":620,"stargazers_count":1373,"open_issues_count":31,"forks_count":50,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-12T06:00:02.151Z","etag":null,"topics":["cli","nix","nix-flake","nixos","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"eupl-1.2","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nix-community.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yaml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["viperML"]}},"created_at":"2022-02-08T19:42:42.000Z","updated_at":"2025-04-11T16:46:36.000Z","dependencies_parsed_at":"2024-01-14T16:09:40.178Z","dependency_job_id":"5bd2474b-8b22-440f-8452-88feedc3d1b4","html_url":"https://github.com/nix-community/nh","commit_stats":{"total_commits":375,"total_committers":15,"mean_commits":25.0,"dds":0.1226666666666667,"last_synced_commit":"6a69a145b0c7dbd5616bbded512b8bf8b5d2f8a4"},"previous_names":["nix-community/nh"],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nix-community%2Fnh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nix-community%2Fnh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nix-community%2Fnh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nix-community%2Fnh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nix-community","download_url":"https://codeload.github.com/nix-community/nh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248525137,"owners_count":21118616,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","nix","nix-flake","nixos","rust"],"created_at":"2025-03-29T02:16:24.199Z","updated_at":"2025-05-14T15:10:56.173Z","avatar_url":"https://github.com/nix-community.png","language":"Rust","funding_links":["https://github.com/sponsors/viperML"],"categories":["Rust","Command-Line Tools"],"sub_categories":["Discovery"],"readme":"\u003c!-- markdownlint-disable no-inline-html --\u003e\n\u003ch1 align=\"center\"\u003enh\u003c/h1\u003e\n\n\u003c!-- markdownlint-disable line-length --\u003e\n\u003ch6 align=\"center\"\u003eBecause the name \"yet-another-\u003cu\u003en\u003c/u\u003eix-\u003cu\u003eh\u003c/u\u003eelper\" was too long to type...\u003c/h1\u003e\n\n## What does it do?\n\n[nix-output-monitor]: https://github.com/maralorn/nix-output-monitor\n[nvd]: https://khumba.net/projects/nvd\n\nNh is a modern helper utility that is a take at reimplementing some commands\nfrom the NixOS ecosystem. We aim to provide more features and better ergonomics\nthan the existing commands.\n\nWe provide several subcommands, such as:\n\n- `os`, which reimplements `nixos-rebuild`, with a tree of builds, diff and\n  confirmation.\n- `home`, which reimplements `home-manager`.\n- `darwin`, which reimplements `darwin-rebuild`\n- `search`, a super-fast package searching tool (powered by a ElasticSearch\n  client).\n- `clean`, my own take at cleaning GC roots from a NixOS system.\n\nThis wouldn't be possible without the programs that nh runs under the hood:\n\n- Tree of builds with [nix-output-monitor].\n- Visualization of the upgrade diff with [nvd].\n- And of course, all the [crates](./Cargo.toml) we depend on.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg\n    alt=\"nh feature showcase\"\n    src=\"./.github/screenshot.png\"\n    width=\"800px\"\n  \u003e\n\u003c/p\u003e\n\n## Installation\n\nThe latest, tagged version will is available in Nixpkgs as Nh stable. This\nrepository provides the latest development version of Nh, which you can get from\nthe flake outputs.\n\n```sh\nnix shell nixpkgs#nh # stable\nnix shell github:viperML/nh # dev\n```\n\n### NixOS\n\nWe provide a NixOS module that integrates `nh clean` as a service. To enable it,\nset the following configuration:\n\n```nix\n{ config, pkgs, ... }:\n{\n  programs.nh = {\n    enable = true;\n    clean.enable = true;\n    clean.extraArgs = \"--keep-since 4d --keep 3\";\n    flake = \"/home/user/my-nixos-config\";\n  };\n}\n```\n\nNh supports both Flakes and classical NixOS configurations:\n\n- For flakes, the command is `nh os switch /path/to/flake`\n- For a classical configuration:\n  - `nh os switch -f '\u003cnixpkgs/nixos\u003e'`, or\n  - `nh os switch -f '\u003cnixpkgs/nixos\u003e' -- -I\n  nixos-config=/path/to/configuration.nix`\n    if using a different location than the default.\n\nYou might want to check `nh os --help` for other values and the defaults from\nenvironment variables.\n\n#### Specialisations support\n\nNh is capable of detecting which specialisation you are running, so it runs the\nproper activation script. To do so, you need to give Nh some information of the\nspec that is currently running by writing its name to `/etc/specialisation`. The\nconfig would look like this:\n\n```nix\n{config, pkgs, ...}: {\n  specialisation.\"foo\".configuration = {\n    environment.etc.\"specialisation\".text = \"foo\";\n    # ..rest of config\n  };\n\n  specialisation.\"bar\".configuration = {\n    environment.etc.\"specialisation\".text = \"bar\";\n    # ..rest of config\n  };\n}\n```\n\n#### Home-Manager\n\nHome specialisations are read from `~/.local/share/home-manager/specialisation`.\nThe config would look like this:\n\n```nix\n{config, pkgs, ...}: {\n  specialisation.\"foo\".configuration = {\n    xdg.dataFile.\"home-manager/specialisation\".text = \"foo\";\n    # ..rest of config\n  };\n\n  specialisation.\"bar\".configuration = {\n    xdg.dataFile.\"home-manager/specialisation\".text = \"bar\";\n    # ..rest of config\n  };\n}\n```\n\n## Status\n\n[![Dependency status](https://deps.rs/repo/github/viperML/nh/status.svg)](https://deps.rs/repo/github/viperML/nh)\n\n[![Packaging status](https://repology.org/badge/vertical-allrepos/nh.svg)](https://repology.org/project/unit/versions)\n\n## Hacking\n\nJust clone and `nix develop`. We also provide a `.envrc` for Direnv.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnix-community%2Fnh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnix-community%2Fnh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnix-community%2Fnh/lists"}