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;
};
};
}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 hunkRun 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.