devenv icon indicating copy to clipboard operation
devenv copied to clipboard

Add support for specifying node versions that aren't available in nixpkgs

Open dudeofawesome opened this issue 1 year ago • 3 comments

It would be very useful to be able to specify node versions that aren't available in nixpkgs, such as versions that aren't supported anymore, or patch versions that were never included in nixpkgs.

Something like the support for Ruby versions would be perfect.

dudeofawesome avatar Aug 13 '24 19:08 dudeofawesome

You can add the source to your devenv.yaml file, which is more general for your use case. If you want to use a Node.js version greater than or equal to 10, you can leverage Nixhub to find the exact Nixpkgs commit and add it to the inputs section: https://www.nixhub.io/packages/nodejs. For example:

# devenv.yaml
inputs:
  nix-nodejs:
    # Node.js 14.17.5
    url: nixpkgs/6cc260cfd60f094500b79e279069b499806bf6d8#nodejs-14_x
# devenv.nix
{ inputs, pkgs }:

let
	nodejs-pkgs = import inputs.nix-nodejs { inherit (pkgs) system; };
in
{
	# omitting

	language.nodejs.package = nodejs-pkgs.nodejs;
}

For older Node.js versions, I don't see anyone maintaining a repository for these ancient versions. In this case, it might be better to maintain your Node.js flake.

pan93412 avatar Aug 18 '24 09:08 pan93412

When trying

languages.javascript.package = pkgs.nodejs-slim_22;

I get

       error: attribute 'nodejs-slim_22' missing

       Did you mean one of nodejs-slim_20, nodejs-slim_21, nodejs-slim_14, nodejs-slim_16 or nodejs-slim_18?

a short devenv search nodejs shows that _22 is indeed not part of the list, but I am unsure why, as it is newer than the one that's currently selected (as of writing this nodejs-slim is on 20.x), however 20.x is already in maintenance mode: https://endoflife.date/nodejs - 22 is active (and LTS) and 23 is current. Neither are in this list. Am I expected to add them to my devenv.yaml as well? At what point in time would devenv choose to support them (and where is the flag that marks these packages as available?) or does devenv just always choose nodejs-slim as the default? But then why is _21 in the list above?

joscha avatar Nov 26 '24 10:11 joscha

@joscha

I can reproduce the same error. devenv use a fork of the unstable channel of the official repository (Ref).

At this time -Dec 22, 2024- node.js 22 is not merge with the updated upstream from official NixOS to the cachix repo

I evaluated an alternative tool and compare with devenv. The alternative is more stable for my usecase with the node.js/ts ecosystem.

The alternative : devbox.

ebauger avatar Dec 04 '24 20:12 ebauger

This is a duplicate of #16

domenkozar avatar Nov 08 '25 16:11 domenkozar