[Nix-dev] yet another npm2nix reengineering attempt
Thomas Hunger
tehunger at gmail.com
Wed Mar 2 12:44:39 CET 2016
Thanks Sander for trying again!
As a data point: We've had too many issues with integrating NPM and nix
more tightly so we've given up and run [1] in combination with shrink-wrap.
I think there may be value in pushing the "resolved" fields from the
npm-shrinkwrap.json file into nix but trying to reproduce the ever-changing
behaviour of the NPM resolver didn't seem like a good time investment to me.
[1]
{ pkgs, stdenv, git, nodejs-5_x }:
# Notes:
# * This still caches in HOME, can't find out how to disable so we
# store in a temporary directory which is cleaned up after the build.
# * This connects NPM to the internet which is sad but
# packaging NPM for nix is even sadder :(
stdenv.mkDerivation {
name = "proppyweb-frontend-node_modules";
src = builtins.filterSource (path: type: baseNameOf path ==
"package.json") ../frontend;
phases = "unpackPhase installPhase";
buildInputs = [ nodejs-5_x git ];
installPhase = ''
mkdir ./npm-home
mkdir -p $out
export HOME=$(readlink -f ./npm-home) # For .npm/cache. Will be
discarded.
cp ./package.json $out/
cd $out
npm install
'';
}
On 2 March 2016 at 01:11, Colin Putney <colin at wiresong.com> wrote:
>
>
> On Tue, Mar 1, 2016 at 6:42 AM, Sander van der Burg <svanderburg at gmail.com
> > wrote:
>
>
>> So as you may see: it is all quite annoying and painful. :(
>>
>
> I'm starting to think that it's pointless to try to make it all work
> automatically. At some point it's so compatible with npm that it replicates
> all of npm's quirks and bugs and you might as well use npm directly,
> because you're not enjoying any of the advantages of nix anymore.
>
> What I've been trying to do is import dependency information from npm, but
> make it easier to customize so that you can work around the quirks of
> specific npm packages with less pain. I'm using the npm2nix in nixpkgs, but
> ignoring the default.nix it generates, and building custom derivations from
> the registry. It's still pretty painful when the generated registry doesn't
> work, but I have managed to get things to work the nix way.
>
> Colin
>
>
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160302/abb5537d/attachment.html
More information about the nix-dev
mailing list