Best practice for pinning version of individual packages

Is there a best practice for pinning a handful of packages, for instance whose builds are currently broken in nixpkgs-unstable, while using the unstable channel for all other packages? (I’d prefer not to roll back all of nixpkgs, as making use of some recent changes to other packages.)

I’ve seen it mentioned (e.g. here) that this is possible, and have tried to replicate this example with something like the following overlay:

self: super:
  nixpkgs = { rev, sha256 }:
    import (super.fetchFromGitHub {
      owner = "NixOS";
      repo = "nixpkgs";
      inherit rev sha256;
    }) { config.allowUnfree = true; };
  last-good-neovim = nixpkgs {
    rev = "81461cff5f540c92e5030f62b89ee7b64e85c6df";
    sha256 = "1kpbw9l69ih9qm143vqpja0njg8fll7jrkph01hqyckm1bnxaljr";
in {
  inherit (last-good-neovim) neovim-unwrapped;

However, with this added to my overlays, nix-env -iA nixos.neovim will hang and consume all available memory, hinting to me that something is wrong (unbounded recursion?) Actually, the same behavior happens with any nix-env command, as far as I can tell, when the above overlay is added.

My questions are

  1. Is there a better practice for pinning a package definition (or set of definitions) to an older nixpkgs hash?
  2. Is there an obvious issue with the above that would explain why nix-env commands seem to choke when it’s added as an overlay?

nix-info -m output:

  • system: "x86_64-darwin"
  • host os: Darwin 19.3.0, macOS 10.15.3
  • multi-user?: yes
  • sandbox: no
  • version: nix-env (Nix) 2.3.3
  • channels(matt): "darwin, home-manager"
  • channels(root): "nixpkgs-20.09pre216412.04d6123309f"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixpkgs

Perhaps it just takes time and resources to fetch the tarball and evaluate it? What do you see in htop when you run a nix command?

So it definitely seems to me like something fishy is going on. This is htop output after running nix-env -iA nixos.neovim-unwrapped for about 30 minutes (with no output):

1 Like

if the package propagates python packages you may hit an awkward wall.

That being said, neovim builds fine on master right now.

I’m facing the same issue. What do you mean by “awkward wall”? All python packages are evaluated?

1 Like

The python interpreter can only import one version of package. So if you are pinning certain packages, then other packages may have their dependency bounds broken, and this won’t be discovered until runtime.

The “awkward wall” is that it’s not til runtime in which you experience the breakages.

Started an answer that spiraled out of control so just put it in a gist.

1 Like