depot/third_party/nixpkgs/pkgs/tools/networking/airfield/default.nix
Default email 8ac5e011d6 Project import generated by Copybara.
GitOrigin-RevId: 2c3273caa153ee8eb5786bc8141b85b859e7efd7
2020-04-24 19:36:52 -04:00

70 lines
1.5 KiB
Nix

{ stdenv, fetchFromGitHub
, pkgs, makeWrapper, buildEnv
, nodejs, runtimeShell
}:
let
nodePackages = import ./node.nix {
inherit pkgs;
system = stdenv.hostPlatform.system;
};
runtimeEnv = buildEnv {
name = "airfield-runtime";
paths = with nodePackages; [
nodePackages."express-3.0.5" nodePackages."swig-0.14.0"
nodePackages."consolidate-0.10.0" redis connect-redis
async request
];
};
name = "airfield-${version}";
version = "2015-01-04";
src = stdenv.mkDerivation {
name = "${name}-src";
inherit version;
src = fetchFromGitHub {
owner = "emblica";
repo = "airfield";
rev = "f021b19a35be3db9be7780318860f3b528c48641";
sha256 = "1xk69x89kgg98hm7c2ysyfmg7pkvgkpg4wym6v5cmdkdid08fsgs";
};
dontBuild = true;
installPhase = ''
mkdir $out
cp -R . $out
'';
};
in stdenv.mkDerivation {
inherit name version src;
buildInputs = [ makeWrapper nodejs ];
dontBuild = true;
installPhase = ''
mkdir -p $out/bin
cat >$out/bin/airfield <<EOF
#!${runtimeShell}
${nodejs}/bin/node ${src}/airfield.js
EOF
'';
postFixup = ''
chmod +x $out/bin/airfield
wrapProgram $out/bin/airfield \
--set NODE_PATH "${runtimeEnv}/lib/node_modules"
'';
meta = with stdenv.lib; {
description = "A web-interface for hipache-proxy";
license = licenses.mit;
homepage = "https://github.com/emblica/airfield";
maintainers = with maintainers; [ offline ];
platforms = platforms.linux;
};
}