Node js 16 EOL and I can't get cache working

> nix shell nixpkgs#nodejs_16

no longer works. It is gone and EOL. I could revert my system, but I want to avoid that. I find SO post (node.js - NixOS install specific NodeJS version - Stack Overflow) that mentions site (Nix Package Versions) that helps you find old revisions that actually work.

So I guess there is this third party site you have to rely on… ok :frowning:

I try recommended command:

> nix-shell -p nodejs_16 -I nixpkgs=

It starts building from source… ok. Oh, it takes several days on some pcs. That won’t work. I try and use substituters command:

> NIXPKGS_ALLOW_INSECURE=1 nix-shell -p nodejs_16 -I nixpkgs= --option

but I don’t really know why it it still insists on building everything from source. This didn’t happen before I updated my system. My guess is that it is not cached anymore?

Next workaround, I put the revision as input in my system’s flake.nix:

    nixpkgs = {
      url = "github:nixos/nixpkgs/nixos-unstable";
    oldnixpkgs = {
      url = "github:nixos/nixpkgs/824421b1796332ad1bcb35bc7855da832c43305f";

I guess this is not the right way to do it. Because:

> nix shell oldnixpkgs#nodejs_16
error: cannot find flake 'flake:oldnixpkgs' in the flake registries

does not work.

Why is this so hard? :(((((((

Another workaround, let’s just download from source. Nope, lol. You are not allowed and does not makes sense because nothing FSH or FHS or whatever, which makes sense.

I would prefer a method of getting node 16 that is as simple as before I updated my system:

> nix shell nixpkgs#nodejs_16

This might be frowned upon, but I have avoided reading about how the nix-env, nix-shell, qpIa, …etc., stuff works because I have gotten really far and built my whole system with just flakes. I like them and they work well. I also like the newer commands.

I am normally really patient, but the fact that this worked like a month ago and I spent a few hours on this already is really frustrating and I hope someone has a good solution for this?

I would like to avoid using a shell.nix file and others, I just want to instantiate a shell with nodejs 16.

Thank you all in advance.

NIXPKGS_ALLOW_INSECURE=1 nix-shell -p nodejs_16 -I nixpkgs= works for me with cache.

Node.js 16 is EOL as you noticed, we provided during the 23.05 release cycle cache for this insecure package, by now, it’s highly recommended to move away from it.

I recommend to stick with release rather than exact revisions if you don’t know exactly what they contains.

1 Like

Thank you :sob: I was getting so frustrated. I will keep this in mind in the future. Cached versions are normally only of releases.

They are more precisely of any channels we have (, so many potential revisions, releases are guaranteed to be cached in practice.

In doubt, prefer releases.

1 Like

I found out from nix shell --help you can request specific versions of the nixpkgs repo.

This is the command I have been looking for :):
NIXPKGS_ALLOW_INSECURE=1 nix shell --impure nixpkgs/23.05#nodejs-16_x

The other solution dropped me into a strange shell and now I get to keep my current shell :slight_smile: