2021-05-20 23:08:51 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, makeWrapper
|
|
|
|
, which
|
|
|
|
, nodejs
|
|
|
|
, mkYarnPackage
|
|
|
|
, python2
|
|
|
|
, nixosTests
|
|
|
|
, buildGoModule
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
# we need a different version than the one already available in nixpkgs
|
|
|
|
esbuild-hedgedoc = buildGoModule rec {
|
|
|
|
pname = "esbuild";
|
|
|
|
version = "0.11.20";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "evanw";
|
|
|
|
repo = "esbuild";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "009f2mfgzkzgxjh3034mzdkcvm5vz17sgy1cs604f0425i22z8qm";
|
|
|
|
};
|
|
|
|
|
|
|
|
vendorSha256 = "1n5538yik72x94vzfq31qaqrkpxds5xys1wlibw2gn2am0z5c06q";
|
|
|
|
};
|
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
mkYarnPackage rec {
|
2021-08-05 21:33:18 +00:00
|
|
|
pname = "hedgedoc";
|
2021-05-20 23:08:51 +00:00
|
|
|
version = "1.8.2";
|
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;
|
2021-05-20 23:08:51 +00:00
|
|
|
sha256 = "1h2wyhap264iqm2jh0i05w0hb2j86jsq1plyl7k3an90w7wngyg1";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ which makeWrapper ];
|
2021-05-20 23:08:51 +00:00
|
|
|
extraBuildInputs = [ python2 esbuild-hedgedoc ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
pushd node_modules/esbuild
|
|
|
|
rm bin/esbuild
|
|
|
|
ln -s ${lib.getBin esbuild-hedgedoc}/bin/esbuild bin/
|
|
|
|
popd
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
npm run build
|
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2020-12-25 13:55:36 +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";
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [ willibutz ma27 globin ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|