···1+#! /usr/bin/env nix-shell
2+#! nix-shell -i bash -p nodePackages.node2nix curl jshon
3+4+set -e
5+6+# Normally, this node2nix invocation would be sufficient:
7+# exec node2nix --input node-packages.json --composition composition.nix
8+#
9+# But pump.io soft-depends on extra modules, which have to be *inside*
10+# its own node_modules, not beside them.
11+#
12+# So we hack these extra deps into package.json and feed that into
13+# node2nix.
14+#
15+# Also jshon does funny things with slashes in strings, which can be
16+# fixed with sed.
17+18+curl https://raw.githubusercontent.com/e14n/pump.io/v1.0.0/package.json | \
19+ jshon -e dependencies \
20+ -s '*' -i databank-mongodb \
21+ -s '*' -i databank-redis \
22+ -s '*' -i databank-memcached \
23+ -s '*' -i databank-lrucache \
24+ -p | sed 's=\\/=/=g' > full-package.json
25+26+node2nix --input full-package.json --composition composition.nix --node-env ../../../development/node-packages/node-env.nix
27+28+# overriding nodePackages src doesn't seem to work, so...
29+sed -i 's|src = ./.|src = fetchurl { url = "https://registry.npmjs.org/pump.io/-/pump.io-1.0.0.tgz"; sha1 = "404mzdqzknrv7pl9qasksi791cc00bbd"; }|' node-packages.nix