2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv, fetchFromGitHub, fetchpatch, makeWrapper
|
2020-09-25 04:45:31 +00:00
|
|
|
, which, nodejs, mkYarnPackage, python2, nixosTests }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
mkYarnPackage rec {
|
2020-12-25 13:55:36 +00:00
|
|
|
name = "hedgedoc";
|
2020-12-29 15:07:52 +00:00
|
|
|
version = "1.7.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2020-12-25 13:55:36 +00:00
|
|
|
owner = "hedgedoc";
|
|
|
|
repo = "hedgedoc";
|
2020-04-24 23:36:52 +00:00
|
|
|
rev = version;
|
2020-12-29 15:07:52 +00:00
|
|
|
sha256 = "0axad5581v25pynfj6pgy0h1xp92dyllnc7mk42z6hxbs4sgkrw1";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ which makeWrapper ];
|
|
|
|
extraBuildInputs = [ python2 ];
|
|
|
|
|
|
|
|
yarnNix = ./yarn.nix;
|
|
|
|
yarnLock = ./yarn.lock;
|
|
|
|
packageJSON = ./package.json;
|
|
|
|
|
|
|
|
postConfigure = ''
|
2020-12-25 13:55:36 +00:00
|
|
|
rm deps/HedgeDoc/node_modules
|
|
|
|
cp -R "$node_modules" deps/HedgeDoc
|
|
|
|
chmod -R u+w deps/HedgeDoc
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
cd deps/HedgeDoc
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
pushd node_modules/sqlite3
|
|
|
|
export CPPFLAGS="-I${nodejs}/include/node"
|
|
|
|
npm run install --build-from-source --nodedir=${nodejs}/include/node
|
|
|
|
popd
|
|
|
|
|
|
|
|
npm run build
|
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
dontInstall = true;
|
|
|
|
|
|
|
|
distPhase = ''
|
|
|
|
runHook preDist
|
|
|
|
|
|
|
|
mkdir -p $out
|
|
|
|
cp -R {app.js,bin,lib,locales,node_modules,package.json,public} $out
|
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
cat > $out/bin/hedgedoc <<EOF
|
2020-04-24 23:36:52 +00:00
|
|
|
#!${stdenv.shell}/bin/sh
|
|
|
|
${nodejs}/bin/node $out/app.js
|
|
|
|
EOF
|
2020-12-25 13:55:36 +00:00
|
|
|
chmod +x $out/bin/hedgedoc
|
|
|
|
wrapProgram $out/bin/hedgedoc \
|
2020-04-24 23:36:52 +00:00
|
|
|
--set NODE_PATH "$out/lib/node_modules"
|
|
|
|
|
|
|
|
runHook postDist
|
|
|
|
'';
|
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
passthru.tests = { inherit (nixosTests) hedgedoc; };
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Realtime collaborative markdown notes on all platforms";
|
|
|
|
license = licenses.agpl3;
|
2020-12-25 13:55:36 +00:00
|
|
|
homepage = "https://hedgedoc.org";
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [ willibutz ma27 globin ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|