3 ms·
They used npm install in their example code? Well that was a poor choice. Having dealt with npm and node apps in my own build system, I have not found a good so
by vishvananda 10y ago
They used npm install in their example code? Well that was a poor choice. Having dealt with npm and node apps in my own build system, I have not found a good solution for deterministically building node apps. Does nix have a solution for this? Thankfully the prepackaged software with reasonable source build systems don't do craziness like this. See the redis package for example:
https://app.habitat.sh/#/pkgs/adam/redis/3.0.7/20160613205253 https://app.habitat.sh/#/pkgs/adam/redis/3.0.7/2016061320525...
- trishume 10y agoNix has a generator that generates a Nix file based on an npm package including SHAs and locked down versions. Unfortunately because typical JS packages use a bajillion dependencies each recursively these Nix files can be tens of thousands of lines, but they work. Nix also has similar generators for rubygems, python, haskell and some other languages. Nix's cargo integration is even cooler since cargo is already quite deterministic, you just put in a SHA of the final folder cargo creates with all the dependencies.
- cwp 10y agoThe nix solution is npm2nix, which runs npm against a package.json file and generates a nix expression for all the npm modules you need. This mostly works, but occasionally you need to override the generated derivations to add implicit dependencies that npm doesn't capture, or otherwise tweak packages that rely on quirks of npm.
- jjuhl 10y agoSo basically it "does not work"...
- jonaf 10y agoWell, let's be clear, if it doesn't work, you know at compile time, not at runtime. I don't care how broken things are at compile time if I'm guaranteed that everything will work at runtime. That's kind of the whole point of nix. It's not impossible to write code with errors, but you should not be able to build as long as the errors exist.
- cwp 10y agoAlso, it does work. It's just not completely automatic.