2018-07-21 01:44:44 +01:00
|
|
|
{ stdenv, fetchFromGitHub
|
2017-11-14 11:08:17 +00:00
|
|
|
, pkgs, makeWrapper, buildEnv
|
2019-02-26 11:45:54 +00:00
|
|
|
, nodejs, runtimeShell
|
2017-11-14 11:08:17 +00:00
|
|
|
}:
|
2014-09-21 00:42:15 +01:00
|
|
|
|
2017-11-14 11:08:17 +00:00
|
|
|
let
|
|
|
|
nodePackages = import ./node.nix {
|
|
|
|
inherit pkgs;
|
2018-08-20 20:11:29 +01:00
|
|
|
system = stdenv.hostPlatform.system;
|
2017-11-14 11:08:17 +00:00
|
|
|
};
|
2014-09-21 00:42:15 +01:00
|
|
|
|
2017-11-14 11:08:17 +00:00
|
|
|
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
|
|
|
|
];
|
2014-09-21 00:42:15 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
name = "airfield-${version}";
|
2017-11-14 11:08:17 +00:00
|
|
|
version = "2015-01-04";
|
|
|
|
|
|
|
|
src = stdenv.mkDerivation {
|
|
|
|
name = "${name}-src";
|
|
|
|
inherit version;
|
2014-09-21 00:42:15 +01:00
|
|
|
|
2017-11-14 11:08:17 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "emblica";
|
|
|
|
repo = "airfield";
|
|
|
|
rev = "f021b19a35be3db9be7780318860f3b528c48641";
|
|
|
|
sha256 = "1xk69x89kgg98hm7c2ysyfmg7pkvgkpg4wym6v5cmdkdid08fsgs";
|
|
|
|
};
|
2014-09-21 00:42:15 +01:00
|
|
|
|
2017-11-14 11:08:17 +00:00
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir $out
|
|
|
|
cp -R . $out
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in stdenv.mkDerivation {
|
|
|
|
inherit name version src;
|
2014-09-21 00:42:15 +01:00
|
|
|
|
2017-11-14 11:08:17 +00:00
|
|
|
buildInputs = [ makeWrapper nodejs ];
|
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cat >$out/bin/airfield <<EOF
|
2019-02-26 11:45:54 +00:00
|
|
|
#!${runtimeShell}
|
2017-11-14 11:08:17 +00:00
|
|
|
${nodejs}/bin/node ${src}/airfield.js
|
|
|
|
EOF
|
2014-09-21 00:42:15 +01:00
|
|
|
'';
|
|
|
|
|
2017-11-14 11:08:17 +00:00
|
|
|
postFixup = ''
|
|
|
|
chmod +x $out/bin/airfield
|
|
|
|
wrapProgram $out/bin/airfield \
|
|
|
|
--set NODE_PATH "${runtimeEnv}/lib/node_modules"
|
|
|
|
'';
|
2014-09-21 00:42:15 +01:00
|
|
|
|
2017-11-14 11:08:17 +00:00
|
|
|
meta = with stdenv.lib; {
|
2015-04-30 16:05:14 +01:00
|
|
|
description = "A web-interface for hipache-proxy";
|
2014-09-21 00:42:15 +01:00
|
|
|
license = licenses.mit;
|
|
|
|
homepage = https://github.com/emblica/airfield;
|
2017-11-14 11:08:17 +00:00
|
|
|
maintainers = with maintainers; [ offline ma27 ];
|
2015-11-17 20:29:29 +00:00
|
|
|
platforms = platforms.linux;
|
2014-09-21 00:42:15 +01:00
|
|
|
};
|
|
|
|
}
|