Nix users can install Hunk from source instead of using npm.
- Add Hunk to your nix flake inputs like such:
{
inputs = {
hunk = {
url = "github:modem-dev/hunk";
inputs.nixpkgs.follows = "nixpkgs";
};
}
}- Use in NixOS
environment.systemPackages:
{
environment.systemPackages = [
inputs.hunk.packages.${pkgs.stdenv.hostPlatform.system}.hunk
];
}Or in Home Manager home.packages:
{
home.packages = [
inputs.hunk.packages.${pkgs.stdenv.hostPlatform.system}.hunk
];
}Hunk provides a Home Manager module to manage both the package and its configuration.
- Add the module to your Home Manager configuration:
{
imports = [
inputs.hunk.homeManagerModules.default
];
programs.hunk = {
enable = true;
enableGitIntegration = true; # Optional: set hunk as default git pager
settings = {
theme = "graphite";
mode = "split";
line_numbers = true;
tab_width = 4;
};
};
}enableGitIntegration writes to Home Manager's Git configuration, so it requires Home Manager's Git module to be enabled with programs.git.enable = true;.
Run Hunk directly with Nix:
nix run github:modem-dev/hunk -- --helpFlake users update Hunk by updating their own pinned flake.lock input:
nix flake lock --update-input hunkThe flake builds for x86_64-linux, aarch64-linux, and aarch64-darwin.
Intel macOS (x86_64-darwin) is not exposed, because Nixpkgs 26.11 dropped support for it and merely declaring a dropped system breaks flake evaluation for everyone consuming Hunk. Intel macOS users should install Hunk via npm or Homebrew instead.
If you pin an older Nixpkgs that still supports a system Hunk does not list, point Hunk's systems input at a wider list:
{
inputs.hunk = {
url = "github:modem-dev/hunk";
inputs.nixpkgs.follows = "nixpkgs";
inputs.systems.url = "github:nix-systems/default"; # adds x86_64-darwin
};
}The same input also drives bun2nix, so overriding it once widens the whole build. If your flake already has its own systems input, inputs.systems.follows = "systems" works too.
Run nix build to build the default package for the current system. The resulting Hunk binary will be ./result/bin/hunk.
You can also build the named package explicitly:
nix build .#hunkWhen JavaScript or Bun dependencies change, regenerate the Nix dependency lockfile and commit it with the dependency change:
bun run nix:update-lockThis script requires Nix and runs the flake-pinned bun2nix version from flake.lock.