2015-01-24 21:54:03 +00:00
|
|
|
{
|
|
|
|
stdenv, pkgs, nodejs
|
|
|
|
|
|
|
|
# Self-reference
|
|
|
|
, self
|
|
|
|
|
|
|
|
# Needed natives for installation
|
|
|
|
, neededNatives ? [pkgs.python] ++ stdenv.lib.optionals stdenv.isLinux [ pkgs.utillinux ]
|
|
|
|
|
|
|
|
# Attribute set of generated packages
|
|
|
|
, generated ? pkgs.callPackage ./node-packages-generated.nix { inherit self; }
|
|
|
|
|
|
|
|
# Attribute set of overrides
|
|
|
|
, overrides ? {}
|
|
|
|
, ...
|
|
|
|
} @ args:
|
|
|
|
|
|
|
|
with stdenv.lib;
|
2012-07-25 21:46:21 +00:00
|
|
|
|
2015-02-23 12:29:06 +00:00
|
|
|
let
|
|
|
|
removeDeps = remove: deps: filterAttrs (n: d: all (r: r != d.pkgName) remove) deps;
|
|
|
|
replaceDep = replace: deps: mapAttrs (n: d: if d.pkgName == replace.pkgName then replace else d) deps;
|
|
|
|
in rec {
|
2015-01-24 21:54:03 +00:00
|
|
|
overrides = {
|
|
|
|
phantomjs.buildInputs = [ pkgs.phantomjs ];
|
|
|
|
"node-expat".buildInputs = [ pkgs.expat ];
|
|
|
|
"node-stringprep".buildInputs = [ pkgs.icu pkgs.which ];
|
|
|
|
"node-protobuf".buildInputs = [ pkgs.protobuf ];
|
2015-01-24 23:33:41 +00:00
|
|
|
|
2015-02-23 12:29:06 +00:00
|
|
|
"tap-0.3.3".patchPhase = ''
|
|
|
|
substituteInPlace package.json --replace '"tap-consumer",' ""
|
2015-01-24 23:33:41 +00:00
|
|
|
'';
|
2015-02-23 12:29:06 +00:00
|
|
|
"node-uptime" = (p: {
|
|
|
|
# Net-ping is not really used
|
|
|
|
patchPhase = ''
|
|
|
|
${self.json}/bin/json -I -f package.json -e 'delete this.dependencies["net-ping"]'
|
|
|
|
'';
|
|
|
|
deps = removeDeps ["net-ping"] p.deps;
|
|
|
|
});
|
|
|
|
bipio = (p: {
|
|
|
|
patchPhase = ''
|
|
|
|
substituteInPlace src/bootstrap.js --replace "memwatch = require('memwatch')," ""
|
|
|
|
${self.json}/bin/json -I -f package.json -e 'this.scripts.install=""'
|
|
|
|
${self.json}/bin/json -I -f package.json -e 'delete this.dependencies.sleep'
|
|
|
|
${self.json}/bin/json -I -f package.json -e 'delete this.dependencies.memwatch'
|
|
|
|
${self.json}/bin/json -I -f package.json -e 'delete this.dependencies["webkit-devtools-agent"]'
|
|
|
|
'';
|
|
|
|
deps = replaceDep self.sleep (removeDeps ["memwatch" "webkit-devtools-agent"] p.deps);
|
|
|
|
});
|
2015-01-26 01:05:57 +00:00
|
|
|
bip-pod.patchPhase = ''
|
|
|
|
substituteInPlace index.js --replace \
|
|
|
|
"__dirname + (literal ? '/' : '/../bip-pod-') + podName" \
|
|
|
|
"(literal ? __dirname + '/' : \"bip-pod-\") + podName"
|
|
|
|
'';
|
2015-02-23 12:29:06 +00:00
|
|
|
webdrvr.preBuild = ''
|
|
|
|
mkdir ../webdrvr
|
|
|
|
ln -s ${pkgs.fetchurl {
|
|
|
|
url = "https://selenium-release.storage.googleapis.com/2.43/selenium-server-standalone-2.43.1.jar";
|
|
|
|
sha1 = "ef1b5f8ae9c99332f99ba8794988a1d5b974d27b";
|
|
|
|
}} ../webdrvr/selenium-server-standalone-2.43.1.jar
|
|
|
|
ln -s ${pkgs.fetchurl {
|
|
|
|
url = "http://chromedriver.storage.googleapis.com/2.10/chromedriver_linux64.zip";
|
|
|
|
sha1 = "26220f7e43ee3c0d714860db61c4d0ecc9bb3d89";
|
|
|
|
}} ../webdrvr/chromedriver_linux64.zip
|
|
|
|
'';
|
2016-03-26 14:27:24 +00:00
|
|
|
bower2nix.buildInputs = [ pkgs.makeWrapper ];
|
|
|
|
bower2nix.postInstall = ''
|
|
|
|
for prog in bower2nix fetch-bower; do
|
2017-10-30 12:16:48 +00:00
|
|
|
wrapProgram "$out/bin/$prog" --prefix PATH : ${stdenv.lib.makeBinPath [ pkgs.git pkgs.nix ]}
|
2016-03-26 14:27:24 +00:00
|
|
|
done
|
|
|
|
'';
|
2015-01-24 21:54:03 +00:00
|
|
|
} // args.overrides or {};
|
2013-05-29 15:22:18 +00:00
|
|
|
|
2015-01-24 21:54:03 +00:00
|
|
|
# Apply overrides and back compatiblity transformations
|
|
|
|
buildNodePackage = {...} @ args:
|
|
|
|
let
|
|
|
|
pkg = makeOverridable (
|
|
|
|
pkgs.callPackage ../development/web/nodejs/build-node-package.nix {
|
|
|
|
inherit nodejs neededNatives;
|
|
|
|
}
|
2015-01-25 00:41:39 +00:00
|
|
|
) (args // (optionalAttrs (isList args.src) {
|
2015-01-24 21:54:03 +00:00
|
|
|
# Backwards compatibility
|
2015-01-25 00:41:39 +00:00
|
|
|
src = head args.src;
|
|
|
|
}) // (optionalAttrs (attrByPath ["passthru" "names"] null args != null) {
|
|
|
|
pkgName = head args.passthru.names;
|
|
|
|
}));
|
2015-01-24 21:54:03 +00:00
|
|
|
|
|
|
|
override = overrides.${args.name} or overrides.${pkg.pkgName} or {};
|
2013-05-28 02:29:00 +00:00
|
|
|
|
2015-01-24 21:54:03 +00:00
|
|
|
in pkg.override override;
|
|
|
|
|
|
|
|
# Backwards compatibility
|
|
|
|
patchSource = fn: srcAttrs: fn srcAttrs;
|
|
|
|
patchLatest = patchSource pkgs.fetchurl;
|
2013-11-14 18:36:08 +00:00
|
|
|
|
2013-05-31 16:50:28 +00:00
|
|
|
/* Put manual packages below here (ideally eventually managed by npm2nix */
|
2015-01-24 21:54:03 +00:00
|
|
|
} // (
|
|
|
|
if isAttrs generated then generated
|
|
|
|
|
|
|
|
# Backwards compatiblity
|
|
|
|
else pkgs.callPackage generated { inherit self; }
|
|
|
|
)
|