Why does nix need to build Node.js 23 from scratch?

Here is my flake.nix and flake.lock. Building from the scratch really costs lots of time and resources.

Environment:

> uname -a
Linux vmi1253861.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

flake.nix

{
  description = "Development environment with pnpm";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/1dab772dd4a68a7bba5d9460685547ff8e17d899";
    flake-utils.url = "github:numtide/flake-utils/b1d9ab70662946ef0850d488da1c9019f3a9752a";
  };

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};
      in
      {
        devShells.default = pkgs.mkShell {
          buildInputs = with pkgs; [
            nodejs_23  # You can change this version as needed
            nodejs_23.pkgs.pnpm
            python310
            
            # Optional but commonly useful tools
            git
          ];

          shellHook = ''
            echo "Node.js development environment with pnpm loaded"
            echo "Node.js version: $(node --version)"
            echo "pnpm version: $(pnpm --version)"
          '';
        };
      });
}

flake.lock

{
  "nodes": {
    "flake-utils": {
      "inputs": {
        "systems": "systems"
      },
      "locked": {
        "lastModified": 1710146030,
        "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
        "owner": "numtide",
        "repo": "flake-utils",
        "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
        "type": "github"
      },
      "original": {
        "owner": "numtide",
        "repo": "flake-utils",
        "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
        "type": "github"
      }
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1736549401,
        "narHash": "sha256-ibkQrMHxF/7TqAYcQE+tOnIsSEzXmMegzyBWza6uHKM=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "1dab772dd4a68a7bba5d9460685547ff8e17d899",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "1dab772dd4a68a7bba5d9460685547ff8e17d899",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "flake-utils": "flake-utils",
        "nixpkgs": "nixpkgs"
      }
    },
    "systems": {
      "locked": {
        "lastModified": 1681028828,
        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
        "owner": "nix-systems",
        "repo": "default",
        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
        "type": "github"
      },
      "original": {
        "owner": "nix-systems",
        "repo": "default",
        "type": "github"
      }
    }
  },
  "root": "root",
  "version": 7
}

And I have aslo checked the cache:
https://cache.nixos.org/9r3j82lsmljr58fkbahbzymz0fvhbckg.narinfo

StorePath: /nix/store/9r3j82lsmljr58fkbahbzymz0fvhbckg-node-v23.5.0.tar.xz
URL: nar/1n5hhccmas1amzra7hjq8n32rpd51yimgm8nqbj24r5rwaspbjm6.nar.xz
Compression: xz
FileHash: sha256:1n5hhccmas1amzra7hjq8n32rpd51yimgm8nqbj24r5rwaspbjm6
FileSize: 48574416
NarHash: sha256:1687jcwib3lmhdj9yp25vj7x0c78z39lhmizvxph9zdnyzmv9v6s
NarSize: 48572760
References: 
Deriver: r6k72nc5p0g64z71636sajhrc8f1plx7-node-v23.5.0.tar.xz.drv
Sig: cache.nixos.org-1:yy7manR9A7ww3YnVjUApDOF5kLdicFRqpij3KhswN4xaKDM2OYavQyWDM/jg9XB+GnqsZlpZOdjLqUDzi2CEAw==
CA: fixed:sha256:1h6sbz0n3xy6pvlx7i5plah3qrjqrhm7rg21mfx6hk3pq0v7prrj

Emmm, it seems to be related to this: Hydra - Latest builds for job nixos:release-24.11:nixpkgs.nodejs_23.x86_64-linux

I found a nixpkgs commit, where Nodejs 23.2 was successfully built. And after switching to that commit, I didn’t need to build it anymore.

1 Like