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

72 lines
1.6 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchFromGitHub, fetchpatch, makeWrapper
, which, nodejs, mkYarnPackage, python2, nixosTests }:
mkYarnPackage rec {
name = "hedgedoc";
version = "1.7.2";
src = fetchFromGitHub {
owner = "hedgedoc";
repo = "hedgedoc";
rev = version;
sha256 = "1w3si1k27c8d9yka2v91883dlz57n0wasan4agi6gw17h9dzb1l6";
2018-08-19 16:54:46 +01:00
};
nativeBuildInputs = [ which makeWrapper ];
2019-08-16 10:17:14 +01:00
extraBuildInputs = [ python2 ];
2018-08-19 16:54:46 +01:00
yarnNix = ./yarn.nix;
yarnLock = ./yarn.lock;
packageJSON = ./package.json;
2018-08-19 16:54:46 +01:00
postConfigure = ''
rm deps/HedgeDoc/node_modules
cp -R "$node_modules" deps/HedgeDoc
chmod -R u+w deps/HedgeDoc
'';
2018-08-19 16:54:46 +01:00
buildPhase = ''
runHook preBuild
2018-08-19 16:54:46 +01:00
cd deps/HedgeDoc
pushd node_modules/sqlite3
export CPPFLAGS="-I${nodejs}/include/node"
npm run install --build-from-source --nodedir=${nodejs}/include/node
popd
2018-08-19 16:54:46 +01:00
npm run build
runHook postBuild
2018-08-19 16:54:46 +01:00
'';
dontInstall = true;
distPhase = ''
runHook preDist
mkdir -p $out
cp -R {app.js,bin,lib,locales,node_modules,package.json,public} $out
cat > $out/bin/hedgedoc <<EOF
#!${stdenv.shell}/bin/sh
${nodejs}/bin/node $out/app.js
2018-08-19 16:54:46 +01:00
EOF
chmod +x $out/bin/hedgedoc
wrapProgram $out/bin/hedgedoc \
--set NODE_PATH "$out/lib/node_modules"
2018-08-19 16:54:46 +01:00
runHook postDist
'';
2018-08-19 16:54:46 +01:00
passthru.tests = { inherit (nixosTests) hedgedoc; };
meta = with lib; {
2018-08-19 16:54:46 +01:00
description = "Realtime collaborative markdown notes on all platforms";
license = licenses.agpl3;
homepage = "https://hedgedoc.org";
maintainers = with maintainers; [ willibutz ma27 globin ];
2018-08-19 16:54:46 +01:00
platforms = platforms.linux;
};
}