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.
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.
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
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?
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:
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 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.
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?