nixpkgs/pkgs/servers/web-apps/codimd/default.nix

74 lines
1.6 KiB
Nix
Raw Normal View History

{ stdenv, fetchFromGitHub, fetchpatch, makeWrapper
, which, nodejs, mkYarnPackage, python2 }:
mkYarnPackage rec {
name = "codimd";
2020-02-19 14:14:26 +00:00
version = "1.6.0";
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
};
nativeBuildInputs = [ which makeWrapper ];
2019-08-16 09:17:14 +00:00
extraBuildInputs = [ python2 ];
2018-08-19 15:54:46 +00:00
yarnNix = ./yarn.nix;
yarnLock = ./yarn.lock;
packageJSON = ./package.json;
2018-08-19 15:54:46 +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
buildPhase = ''
runHook preBuild
2018-08-19 15:54:46 +00:00
cd deps/CodiMD
2018-08-19 15:54:46 +00:00
pushd node_modules/codemirror
npm run install
popd
pushd node_modules/sqlite3
export CPPFLAGS="-I${nodejs}/include/node"
npm run install --build-from-source --nodedir=${nodejs}/include/node
popd
2018-08-19 15:54:46 +00:00
npm run build
runHook postBuild
2018-08-19 15:54:46 +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
#!${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 \
--set NODE_PATH "$out/lib/node_modules"
2018-08-19 15:54:46 +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;
homepage = "https://github.com/codimd/server";
maintainers = with maintainers; [ willibutz ma27 globin ];
2018-08-19 15:54:46 +00:00
platforms = platforms.linux;
};
}