Where's the NodeJS Apps?

I’ve had a couple of occasions now where I’ve gone to try to use an application, to find it not in nixpkgs. It’s not an unresaonable thing, but I noticed they’re all specifically NodeJS apps, such as Prettier, AWS CDK, ZoweCLI, ESLint, etc…

I can understand if there’s a hesitancy for building them considering NodeJS’ notoriously slow build times, but that doesn’t seem to me like that’d be it. I thought maybe because they’re interpreted, but there’s standalone packages for some python apps.

Is there any particular reason anybody knows of, or has any ideas? This might just be me being too new to NodeJS and a newbie when it comes to package management, so if it’s obvious, I’m sorry.

NodeJS applications are part of nodePackages. Something like this works for me:

nix-shell -p nodePackages.prettier  -p nodePackages.eslint 

You can look these up on NixOS packages: NixOS Search - Loading...

AWS CDK and ZoweCLI do not seem to be packaged.
They can be installed using npm (npm install -g cdk). For me, this is usually the most practical way. This can sometimes break over time though: when your npm package has native extensions, it needs to compile against shared libraries, the shared libraries may eventually be removed, which will result in these native extensions not being able to find the shared libraries they were compiled against.

node2nix can be used if you want to package them for Nix. See GitHub - svanderburg/node2nix: Generate Nix expressions to build NPM packages


Huh. They’re not showing up when I search for them with nix search nixpkgs prettier or any nodePackages, but sure enough, I can get a shell with nix shell nixpkgs#nodePackages.prettier.

Good to hear they are there, I’m just wondering now why they don’t show in search for me.

Edit: Yeah, I’ve used node2nix before with flakes and such, and it’s pretty nice for building. A little bit of a headache to find the exact part to call into though

Ah, I guess nix search doesn’t look inside sub-attributes. Not sure if it will do this once Nix 2.4 comes out, but it might be a good idea to submit an issue for this on Issues · NixOS/nix · GitHub

Yeah, I’ve used node2nix before with flakes and such, and it’s pretty nice for building. A little bit of a headache to find the exact part to call into though

Fully agreed.


I’m certain it does check sub-attributes, since I can see python39Packages and various perl, ocaml, haxe, and lisp ones. Just not node for some reason. I’ll definitely see if I can look deeper into it to see if the backend is 404-ing or what’s going on, thanks!

I can’t seem to find the issue for it on nixpkgs and I’m not sure if its still true. But I remember there being a problem with nodePackages right now in nixpkgs.
nix search does usually search through sub attributes. As you mentioned it works with pythonPackages.

It looks like nixpkgs in the background is using node2nix. @bobvanderlinden You did mention that problem with the breaking though when shared libraries are removed. Is it possible that since they all use the same node-packages.nix that someone updating a package could break things like that?

Edit: node-packages.nix, not the json file

Actually, if I think about it, I am able to search it directly if I search nix search nixpkgs#nodePackages prettier, and I can install from it.

I did find this line in the nix search.md in the source:


Right now, I’d bet that recurseForDerivations isn’t true for nodePackages.

Edit: or that there isn’t a node-packages.nix in nixpkgs/pkgs/top-level at master · NixOS/nixpkgs · GitHub is also a little suspicious

1 Like

No, I only mentioned breakage using npm install, because the dependencies are not managed by Nix that way. node2nix should be good.

Hmm, looked through nixpkgs for the recursing feature. It doesn’t search through files, but through attributes. So you need to look at nodePackages inside all-packages.nix. That line also looks suspicious:

1 Like

That’s gotta be it. All the other attribute sets we can see are marked recurseIntoAttrs, and I noticed you can’t search some like haskellPackages and steamPackages unless you specify the attribute.

I don’t see why though that nodePackages would be marked as “don’t recurse” since that one’s supposed to be applications, not libraries.

Edit: I see this issue that might be related: 10081 packages disapeared from packages.json · Issue #110348 · NixOS/nixpkgs · GitHub.

Edit 2: Probably not actually, but something similar might have happened. I see a number of packages that reference nodePackages.<package_name> that are at the top level, but that doesn’t include some apps like Prettier.

Edit 3: Yep that’s it: all-packages.nix: introduce and use `dontRecurseIntoAttrs` by oxij · Pull Request #56105 · NixOS/nixpkgs · GitHub when it was first implemented, the various nodePackages sets got a dontRecurseIntoAttrs implementation. I’m guessing that stuck as time went on.

So I’ve come full circle I suppose to revise my original question: Why aren’t there more top-level NodeJS apps, if that’s the intended implementation for application packages?

Edit finale: Either way, it should really be consistent, with either all those apps available at the top level or making the nodePackages attribute set searchable. Thank you @bobvanderlinden and @Pacman99, I’ll be moving this to GitHub now: Discrepency Between Node Application Package Level · Issue #117146 · NixOS/nixpkgs · GitHub