2019-07-13 13:09:39 +00:00
|
|
|
{ stdenv, fetchFromGitHub, fetchpatch, makeWrapper
|
2019-10-20 20:32:31 +00:00
|
|
|
, which, nodejs, mkYarnPackage, python2 }:
|
2019-07-13 13:09:39 +00:00
|
|
|
|
2019-10-20 20:32:31 +00:00
|
|
|
mkYarnPackage rec {
|
2019-07-13 13:09:39 +00:00
|
|
|
name = "codimd";
|
2020-02-19 14:14:26 +00:00
|
|
|
version = "1.6.0";
|
2019-07-13 13:09:39 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "codimd";
|
|
|
|
repo = "server";
|
|
|
|
rev = version;
|
2020-02-19 14:14:26 +00:00
|
|
|
sha256 = "1208a24v664ha9qzr7ky6i3ynphkaj0xi5l3rsw743i22nv5aj33";
|
2018-08-19 15:54:46 +00:00
|
|
|
};
|
|
|
|
|
2019-07-13 13:09:39 +00:00
|
|
|
nativeBuildInputs = [ which makeWrapper ];
|
2019-08-16 09:17:14 +00:00
|
|
|
extraBuildInputs = [ python2 ];
|
2018-08-19 15:54:46 +00:00
|
|
|
|
2019-07-13 13:09:39 +00:00
|
|
|
yarnNix = ./yarn.nix;
|
|
|
|
yarnLock = ./yarn.lock;
|
|
|
|
packageJSON = ./package.json;
|
2018-08-19 15:54:46 +00:00
|
|
|
|
2019-07-13 13:09:39 +00:00
|
|
|
postConfigure = ''
|
|
|
|
rm deps/CodiMD/node_modules
|
|
|
|
cp -R "$node_modules" deps/CodiMD
|
|
|
|
chmod -R u+w deps/CodiMD
|
|
|
|
'';
|
2018-08-19 15:54:46 +00:00
|
|
|
|
2019-07-13 13:09:39 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
2018-08-19 15:54:46 +00:00
|
|
|
|
2019-07-13 13:09:39 +00:00
|
|
|
cd deps/CodiMD
|
2018-08-19 15:54:46 +00:00
|
|
|
|
2019-07-13 13:09:39 +00:00
|
|
|
pushd node_modules/codemirror
|
|
|
|
npm run install
|
|
|
|
popd
|
|
|
|
|
|
|
|
pushd node_modules/sqlite3
|
2019-11-22 22:41:13 +00:00
|
|
|
export CPPFLAGS="-I${nodejs}/include/node"
|
|
|
|
npm run install --build-from-source --nodedir=${nodejs}/include/node
|
2019-07-13 13:09:39 +00:00
|
|
|
popd
|
|
|
|
|
2018-08-19 15:54:46 +00:00
|
|
|
npm run build
|
2019-07-13 13:09:39 +00:00
|
|
|
|
|
|
|
runHook postBuild
|
2018-08-19 15:54:46 +00:00
|
|
|
'';
|
|
|
|
|
2019-07-13 13:09:39 +00:00
|
|
|
dontInstall = true;
|
|
|
|
|
|
|
|
distPhase = ''
|
|
|
|
runHook preDist
|
|
|
|
|
|
|
|
mkdir -p $out
|
|
|
|
cp -R {app.js,bin,lib,locales,node_modules,package.json,public} $out
|
|
|
|
|
2018-08-19 15:54:46 +00:00
|
|
|
cat > $out/bin/codimd <<EOF
|
2019-07-13 13:09:39 +00:00
|
|
|
#!${stdenv.shell}/bin/sh
|
|
|
|
${nodejs}/bin/node $out/app.js
|
2018-08-19 15:54:46 +00:00
|
|
|
EOF
|
|
|
|
chmod +x $out/bin/codimd
|
|
|
|
wrapProgram $out/bin/codimd \
|
2019-07-13 13:09:39 +00:00
|
|
|
--set NODE_PATH "$out/lib/node_modules"
|
2018-08-19 15:54:46 +00:00
|
|
|
|
2019-07-13 13:09:39 +00:00
|
|
|
runHook postDist
|
|
|
|
'';
|
2018-08-19 15:54:46 +00:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Realtime collaborative markdown notes on all platforms";
|
|
|
|
license = licenses.agpl3;
|
2019-07-13 13:09:39 +00:00
|
|
|
homepage = "https://github.com/codimd/server";
|
2019-08-20 17:36:05 +00:00
|
|
|
maintainers = with maintainers; [ willibutz ma27 globin ];
|
2018-08-19 15:54:46 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|