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

74 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.8.0";
src = fetchFromGitHub {
owner = "hedgedoc";
repo = "hedgedoc";
rev = version;
sha256 = "1xi4gi1yjwggdsnz5hljx9xl4qhnm9r3c24q7i6d5y8yv6lh6lsr";
2018-08-19 15:54:46 +00:00
};
nativeBuildInputs = [ which makeWrapper ];
2019-08-16 09:17:14 +00:00
extraBuildInputs = [ python2 ];
2018-08-19 15:54:46 +00:00
yarnNix = ./yarn.nix;
yarnLock = ./yarn.lock;
packageJSON = ./package.json;
2018-08-19 15:54:46 +00:00
postConfigure = ''
rm deps/HedgeDoc/node_modules
cp -R "$node_modules" deps/HedgeDoc
chmod -R u+w deps/HedgeDoc
'';
2018-08-19 15:54:46 +00:00
buildPhase = ''
runHook preBuild
2018-08-19 15:54:46 +00: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 15:54:46 +00:00
npm run build
patchShebangs bin/*
runHook postBuild
2018-08-19 15:54:46 +00: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 15:54:46 +00:00
EOF
chmod +x $out/bin/hedgedoc
wrapProgram $out/bin/hedgedoc \
--set NODE_PATH "$out/lib/node_modules"
2018-08-19 15:54:46 +00:00
runHook postDist
'';
2018-08-19 15:54:46 +00:00
passthru.tests = { inherit (nixosTests) hedgedoc; };
meta = with lib; {
2018-08-19 15:54:46 +00: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 15:54:46 +00:00
platforms = platforms.linux;
};
}