2014-09-13 10:03:01 +02:00
|
|
|
{ stdenv, buildEnv, fetchgit, makeWrapper, writeScript, fetchurl, zip, pkgs
|
|
|
|
, node_webkit }:
|
2014-07-26 14:39:06 +02:00
|
|
|
|
|
|
|
let
|
2014-07-27 08:23:11 +02:00
|
|
|
name = "zed-${version}";
|
2015-05-21 21:13:31 +02:00
|
|
|
version = "1.1.0";
|
2014-07-26 14:39:06 +02:00
|
|
|
|
2017-11-08 07:08:20 +01:00
|
|
|
nodePackages = import ./node.nix {
|
2014-07-27 08:23:11 +02:00
|
|
|
inherit pkgs;
|
2017-11-08 07:08:20 +01:00
|
|
|
system = stdenv.system;
|
2014-07-27 08:23:11 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
node_env = buildEnv {
|
|
|
|
name = "node_env";
|
2017-11-08 07:08:20 +01:00
|
|
|
paths = [ nodePackages."body-parser-~1.6.3" nodePackages."express-~4.8.3"
|
|
|
|
nodePackages."request-~2.34.0" nodePackages."tar-~0.1.19"
|
|
|
|
nodePackages."ws-~0.4.32" ];
|
2014-07-27 08:23:11 +02:00
|
|
|
pathsToLink = [ "/lib" ];
|
2014-09-13 10:03:01 +02:00
|
|
|
ignoreCollisions = true;
|
2014-07-27 08:23:11 +02:00
|
|
|
};
|
2014-07-26 14:39:06 +02:00
|
|
|
|
|
|
|
zed = stdenv.mkDerivation rec {
|
|
|
|
inherit name version;
|
|
|
|
|
2014-07-27 08:23:11 +02:00
|
|
|
src = fetchgit {
|
|
|
|
url = "git://github.com/zedapp/zed";
|
|
|
|
rev = "refs/tags/v${version}";
|
2015-05-21 21:13:31 +02:00
|
|
|
sha256 = "1zvlngv73h968jd2m42ylr9vfhf35n80wzy616cv2ic7gmr1fl9p";
|
2014-07-27 08:23:11 +02:00
|
|
|
};
|
2014-07-26 14:39:06 +02:00
|
|
|
|
2014-07-27 08:23:11 +02:00
|
|
|
buildInputs = [ makeWrapper zip ];
|
|
|
|
|
|
|
|
dontBuild = true;
|
2014-07-26 14:39:06 +02:00
|
|
|
|
|
|
|
installPhase = ''
|
2014-07-27 08:23:11 +02:00
|
|
|
export NWPATH="${node_webkit}/share/node-webkit";
|
|
|
|
|
2014-07-26 14:39:06 +02:00
|
|
|
mkdir -p $out/zed
|
2014-07-27 08:23:11 +02:00
|
|
|
|
|
|
|
cd ${src}/app; zip -r $out/zed/app.nw *; cd ..
|
|
|
|
|
|
|
|
cat $NWPATH/nw $out/zed/app.nw > $out/zed/zed-bin
|
|
|
|
cp $NWPATH/nw.pak $out/zed/
|
|
|
|
cp nw/zed-linux $out/zed/zed
|
|
|
|
chmod +x $out/zed/zed*
|
|
|
|
cp Zed.desktop.tmpl Zed.svg Zed.png $out/zed
|
|
|
|
rm $out/zed/app.nw
|
2014-07-26 14:39:06 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
wrapProgram $out/zed/zed-bin \
|
2014-07-27 08:23:11 +02:00
|
|
|
--prefix NODE_PATH : ${node_env}/lib/node_modules
|
2014-07-26 14:39:06 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2014-07-27 08:23:11 +02:00
|
|
|
zed_script = writeScript "zed.sh" ''
|
|
|
|
if [[ $1 == http://* ]] || [[ $1 == https://* ]]; then
|
|
|
|
PROJECT=$1
|
|
|
|
elif [ "" != "$1" ]; then
|
|
|
|
PROJECT=$(readlink -f $1)
|
|
|
|
fi
|
|
|
|
${zed}/zed/zed-bin $PROJECT
|
2014-07-26 14:39:06 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
inherit name version;
|
|
|
|
|
|
|
|
src = zed;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
2014-07-27 08:23:11 +02:00
|
|
|
ln -s ${zed_script} $out/bin/zed
|
2014-07-26 14:39:06 +02:00
|
|
|
'';
|
|
|
|
|
2017-11-08 07:08:20 +01:00
|
|
|
meta = with stdenv.lib; {
|
2015-04-30 17:05:14 +02:00
|
|
|
description = "A fully offline-capable, open source, keyboard-focused, text and code editor for power users";
|
2017-11-08 07:08:20 +01:00
|
|
|
license = licenses.mit;
|
2014-07-26 14:39:06 +02:00
|
|
|
homepage = http://zedapp.org/;
|
2017-11-08 07:08:20 +01:00
|
|
|
maintainers = with maintainers; [ matejc ma27 ];
|
|
|
|
platforms = platforms.linux;
|
2014-07-26 14:39:06 +02:00
|
|
|
};
|
|
|
|
}
|