2021-05-20 23:08:51 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2022-08-12 12:06:08 +00:00
|
|
|
, fetchzip
|
2021-05-20 23:08:51 +00:00
|
|
|
, makeWrapper
|
|
|
|
, which
|
|
|
|
, nodejs
|
|
|
|
, mkYarnPackage
|
2021-10-17 09:34:42 +00:00
|
|
|
, fetchYarnDeps
|
2021-12-30 13:39:12 +00:00
|
|
|
, python3
|
2021-05-20 23:08:51 +00:00
|
|
|
, nixosTests
|
|
|
|
}:
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
mkYarnPackage rec {
|
2021-08-05 21:33:18 +00:00
|
|
|
pname = "hedgedoc";
|
2022-11-21 17:40:18 +00:00
|
|
|
version = "1.9.6";
|
2022-08-12 12:06:08 +00:00
|
|
|
|
|
|
|
# we use the upstream compiled js files because yarn2nix cannot handle different versions of dependencies
|
|
|
|
# in development and production and the web assets muts be compiled with js-yaml 3 while development
|
|
|
|
# uses js-yaml 4 which breaks the text editor
|
|
|
|
src = fetchzip {
|
|
|
|
url = "https://github.com/hedgedoc/hedgedoc/releases/download/${version}/hedgedoc-${version}.tar.gz";
|
2022-11-21 17:40:18 +00:00
|
|
|
hash = "sha256-NoA4mv9LyvShr4fdfBSHgDoyxY59ubRC8YC6hvOimZc=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ which makeWrapper ];
|
2022-08-12 12:06:08 +00:00
|
|
|
extraBuildInputs = [ python3 ];
|
|
|
|
|
|
|
|
packageJSON = ./package.json;
|
|
|
|
yarnFlags = [ "--production" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-10-17 09:34:42 +00:00
|
|
|
offlineCache = fetchYarnDeps {
|
2022-08-12 12:06:08 +00:00
|
|
|
yarnLock = src + "/yarn.lock";
|
2022-11-21 17:40:18 +00:00
|
|
|
sha256 = "1xxq02mgys3bp7ivgsr9hyafd866ygw2bp3rbld2500afvayz89v";
|
2021-10-17 09:34:42 +00:00
|
|
|
};
|
2021-09-26 12:46:18 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
configurePhase = ''
|
|
|
|
cp -r "$node_modules" node_modules
|
|
|
|
chmod -R u+w node_modules
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
|
|
|
pushd node_modules/sqlite3
|
|
|
|
export CPPFLAGS="-I${nodejs}/include/node"
|
|
|
|
npm run install --build-from-source --nodedir=${nodejs}/include/node
|
|
|
|
popd
|
|
|
|
|
2021-05-04 21:07:42 +00:00
|
|
|
patchShebangs bin/*
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2021-10-17 09:34:42 +00:00
|
|
|
passthru = {
|
|
|
|
tests = { inherit (nixosTests) hedgedoc; };
|
|
|
|
};
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Realtime collaborative markdown notes on all platforms";
|
|
|
|
license = licenses.agpl3;
|
2020-12-25 13:55:36 +00:00
|
|
|
homepage = "https://hedgedoc.org";
|
2022-08-12 12:06:08 +00:00
|
|
|
maintainers = with maintainers; [ willibutz SuperSandro2000 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|