2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fetchpatch, makeWrapper
|
2020-09-08 19:03:41 +01:00
|
|
|
, which, nodejs, mkYarnPackage, python2, nixosTests }:
|
2019-07-13 14:09:39 +01:00
|
|
|
|
2019-10-20 21:32:31 +01:00
|
|
|
mkYarnPackage rec {
|
2020-11-29 17:47:34 +00:00
|
|
|
name = "hedgedoc";
|
2021-01-15 23:41:04 +00:00
|
|
|
version = "1.7.2";
|
2019-07-13 14:09:39 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2020-11-29 17:47:34 +00:00
|
|
|
owner = "hedgedoc";
|
|
|
|
repo = "hedgedoc";
|
2019-07-13 14:09:39 +01:00
|
|
|
rev = version;
|
2021-01-15 23:41:04 +00:00
|
|
|
sha256 = "1w3si1k27c8d9yka2v91883dlz57n0wasan4agi6gw17h9dzb1l6";
|
2018-08-19 16:54:46 +01:00
|
|
|
};
|
|
|
|
|
2019-07-13 14:09:39 +01:00
|
|
|
nativeBuildInputs = [ which makeWrapper ];
|
2019-08-16 10:17:14 +01:00
|
|
|
extraBuildInputs = [ python2 ];
|
2018-08-19 16:54:46 +01:00
|
|
|
|
2019-07-13 14:09:39 +01:00
|
|
|
yarnNix = ./yarn.nix;
|
|
|
|
yarnLock = ./yarn.lock;
|
|
|
|
packageJSON = ./package.json;
|
2018-08-19 16:54:46 +01:00
|
|
|
|
2019-07-13 14:09:39 +01:00
|
|
|
postConfigure = ''
|
2020-11-29 17:47:34 +00:00
|
|
|
rm deps/HedgeDoc/node_modules
|
|
|
|
cp -R "$node_modules" deps/HedgeDoc
|
|
|
|
chmod -R u+w deps/HedgeDoc
|
2019-07-13 14:09:39 +01:00
|
|
|
'';
|
2018-08-19 16:54:46 +01:00
|
|
|
|
2019-07-13 14:09:39 +01:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
2018-08-19 16:54:46 +01:00
|
|
|
|
2020-11-29 17:47:34 +00:00
|
|
|
cd deps/HedgeDoc
|
2019-07-13 14:09:39 +01:00
|
|
|
|
|
|
|
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 14:09:39 +01:00
|
|
|
popd
|
|
|
|
|
2018-08-19 16:54:46 +01:00
|
|
|
npm run build
|
2019-07-13 14:09:39 +01:00
|
|
|
|
|
|
|
runHook postBuild
|
2018-08-19 16:54:46 +01:00
|
|
|
'';
|
|
|
|
|
2019-07-13 14:09:39 +01:00
|
|
|
dontInstall = true;
|
|
|
|
|
|
|
|
distPhase = ''
|
|
|
|
runHook preDist
|
|
|
|
|
|
|
|
mkdir -p $out
|
|
|
|
cp -R {app.js,bin,lib,locales,node_modules,package.json,public} $out
|
|
|
|
|
2020-11-29 17:47:34 +00:00
|
|
|
cat > $out/bin/hedgedoc <<EOF
|
2019-07-13 14:09:39 +01:00
|
|
|
#!${stdenv.shell}/bin/sh
|
|
|
|
${nodejs}/bin/node $out/app.js
|
2018-08-19 16:54:46 +01:00
|
|
|
EOF
|
2020-11-29 17:47:34 +00:00
|
|
|
chmod +x $out/bin/hedgedoc
|
|
|
|
wrapProgram $out/bin/hedgedoc \
|
2019-07-13 14:09:39 +01:00
|
|
|
--set NODE_PATH "$out/lib/node_modules"
|
2018-08-19 16:54:46 +01:00
|
|
|
|
2019-07-13 14:09:39 +01:00
|
|
|
runHook postDist
|
|
|
|
'';
|
2018-08-19 16:54:46 +01:00
|
|
|
|
2020-11-29 17:47:34 +00:00
|
|
|
passthru.tests = { inherit (nixosTests) hedgedoc; };
|
2020-09-08 19:03:41 +01:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2018-08-19 16:54:46 +01:00
|
|
|
description = "Realtime collaborative markdown notes on all platforms";
|
|
|
|
license = licenses.agpl3;
|
2020-11-29 17:47:34 +00:00
|
|
|
homepage = "https://hedgedoc.org";
|
2019-08-20 18:36:05 +01:00
|
|
|
maintainers = with maintainers; [ willibutz ma27 globin ];
|
2018-08-19 16:54:46 +01:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|