I just recently found the time to finally try out what’s been cooking in nixUnstable and need to re-learn doing the thing I usually do when working with Nix.
One of these is overriding nixpkgs with a local checkout.
How can I do the equivalent of e.g.
nix run nixpkgs.hello -I nixpkgs=~/Projects/nixpkgs now?
The new command is
nix shell and you now use
nixpkgs#hello instead of referencing nixpkgs from the NIX_PATH but how can I override what the nixpkgs flake points to in an ad-hoc manner?
I know the registry exists but that’s more of an alternative for channel management and I don’t want to make any permanent changes.
You can use
/path/to/nixpkgs#hello but that dumps
/path/to/nixpkgs into the nix store every time you try to do anything with it which is entirely unusable as every bash completion now waits for the nix-daemon to dump
/path/to/nixpkgs into the nix store again. I just want to eval the current state of the flake at
Speaking of completions, another issue I had was that nix-bash-completions are broken for
nix commands. Nix now has it’s own bash completions but unfortunately, there does not seem to be a bash completion for e.g.
nix build -f /path/to/nixpkgs hell<TAB> or the old
Is there a way to use
nix‘s completion for the new nix commands and nix-bash-completions’ for the old ones?
Currently, I manage my system-wide nixpkgs rev with a worktree of my local Nixpkgs checkout of my Nixpkgs fork where I merge and cherry pick things before they make it into master.
I usually make changes in my nixpkgs checkout’s master and then use a bash alias to update the worktree to that rev once I’m done. How can I translate that into the new way?
I could use
github:Atemu/nixpkgs but I don’t want to have to push my changes to GH every time I make some experimental change and want it to be in-effect for every Nix invocation system-wide.