{ lib , stdenv , fetchzip , makeWrapper , which , nodejs , mkYarnPackage , fetchYarnDeps , python3 , nixosTests }: mkYarnPackage rec { pname = "hedgedoc"; version = "1.9.5"; # 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"; hash = "sha256-dcqCc4UUI1knRlDfQlXq3cpTRTh+kbgFynbypDzw9y8="; }; nativeBuildInputs = [ which makeWrapper ]; extraBuildInputs = [ python3 ]; packageJSON = ./package.json; yarnFlags = [ "--production" ]; offlineCache = fetchYarnDeps { yarnLock = src + "/yarn.lock"; sha256 = "18k2q2llngdk0gsyjrwpirhvwmkwgzhx8nw1rx7g7v2nfzyz189b"; }; configurePhase = '' cp -r "$node_modules" node_modules chmod -R u+w node_modules ''; buildPhase = '' runHook preBuild pushd node_modules/sqlite3 export CPPFLAGS="-I${nodejs}/include/node" npm run install --build-from-source --nodedir=${nodejs}/include/node popd patchShebangs bin/* runHook postBuild ''; 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 <