2016-10-20 06:49:22 +00:00
|
|
|
{ stdenv, makeWrapper, callPackage, lib, buildEnv, fetchgit, nodePackages, nodejs }:
|
2015-10-08 23:06:22 +00:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
2016-10-20 06:49:22 +00:00
|
|
|
np = (callPackage <nixpkgs/pkgs/top-level/node-packages.nix>) {
|
2015-10-08 23:06:22 +00:00
|
|
|
generated = ./packages.nix;
|
|
|
|
self = np;
|
|
|
|
};
|
|
|
|
|
|
|
|
node_env = buildEnv {
|
|
|
|
name = "node_env";
|
|
|
|
paths = [
|
|
|
|
np.redis
|
|
|
|
np."formidable"
|
|
|
|
];
|
|
|
|
pathsToLink = [ "/lib" ];
|
|
|
|
ignoreCollisions = true;
|
|
|
|
};
|
|
|
|
|
2016-10-20 06:49:22 +00:00
|
|
|
in np.buildNodePackage {
|
2016-10-27 12:47:21 +00:00
|
|
|
name = "go-shortener";
|
2015-10-08 23:06:22 +00:00
|
|
|
|
|
|
|
src = fetchgit {
|
2016-07-01 10:04:16 +00:00
|
|
|
url = "http://cgit.lassul.us/go/";
|
2015-10-08 23:06:22 +00:00
|
|
|
rev = "05d02740e0adbb36cc461323647f0c1e7f493156";
|
|
|
|
sha256 = "6015c9a93317375ae8099c7ab982df0aa93a59ec2b48972e253887bb6ca0004f";
|
|
|
|
};
|
|
|
|
|
|
|
|
phases = [
|
|
|
|
"unpackPhase"
|
|
|
|
"installPhase"
|
|
|
|
];
|
|
|
|
|
|
|
|
deps = (filter (v: nixType v == "derivation") (attrValues np));
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
nodejs
|
|
|
|
makeWrapper
|
|
|
|
];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
|
|
|
|
cp index.js $out/
|
|
|
|
cat > $out/go << EOF
|
|
|
|
${nodejs}/bin/node $out/index.js
|
|
|
|
EOF
|
|
|
|
chmod +x $out/go
|
|
|
|
|
|
|
|
wrapProgram $out/go \
|
|
|
|
--prefix NODE_PATH : ${node_env}/lib/node_modules
|
|
|
|
|
|
|
|
ln -s $out/go /$out/bin/go
|
|
|
|
'';
|
|
|
|
|
|
|
|
}
|