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