···11+#! /usr/bin/env nix-shell
22+#! nix-shell -i bash -p nodePackages.node2nix curl jshon
33+44+set -e
55+66+# Normally, this node2nix invocation would be sufficient:
77+# exec node2nix --input node-packages.json --composition composition.nix
88+#
99+# But pump.io soft-depends on extra modules, which have to be *inside*
1010+# its own node_modules, not beside them.
1111+#
1212+# So we hack these extra deps into package.json and feed that into
1313+# node2nix.
1414+#
1515+# Also jshon does funny things with slashes in strings, which can be
1616+# fixed with sed.
1717+1818+curl https://raw.githubusercontent.com/e14n/pump.io/v1.0.0/package.json | \
1919+ jshon -e dependencies \
2020+ -s '*' -i databank-mongodb \
2121+ -s '*' -i databank-redis \
2222+ -s '*' -i databank-memcached \
2323+ -s '*' -i databank-lrucache \
2424+ -p | sed 's=\\/=/=g' > full-package.json
2525+2626+node2nix --input full-package.json --composition composition.nix --node-env ../../../development/node-packages/node-env.nix
2727+2828+# overriding nodePackages src doesn't seem to work, so...
2929+sed -i 's|src = ./.|src = fetchurl { url = "https://registry.npmjs.org/pump.io/-/pump.io-1.0.0.tgz"; sha1 = "404mzdqzknrv7pl9qasksi791cc00bbd"; }|' node-packages.nix