A local repository instead of a Nix channel

Is it possible to use a local Git repository instead of a Nix channel temporarily? I’ve got a couple of pending PRs for issues that affect my system and would like to use the Git repository instead of the channel by default without having to remember to pass -I nixpkgs=~/code/nixpkgs/ to nixos-rebuild every time.
Thanks in advance.


On NixOS, you can use nix.nixPath = [ "nixpkgs=/path/to/git"]; (untested), or add nixpkgs=/path/to/git in your NIX_PATH environment variable

1 Like

Thanks for the hint, nix.nixPath is what I was looking for. One adjustment I had to make was to specify nixos-config, otherwise nixos-rebuild forgets where the configuration is located:

nix.nixPath = [