mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 00:12:56 +00:00
Merge pull request #182643 from SuperSandro2000/hedgedoc
hedgedoc: fix editor crashing
This commit is contained in:
commit
f7b39d232b
@ -35,8 +35,6 @@ mkYarnPackage rec {
|
||||
name = "uivonim-build-${version}";
|
||||
inherit version src packageJSON yarnLock yarnNix yarnPreBuild distPhase;
|
||||
|
||||
yarnFlags = [ "--offline" ];
|
||||
|
||||
buildPhase = ''
|
||||
yarn build:prod
|
||||
'';
|
||||
@ -47,7 +45,7 @@ mkYarnPackage rec {
|
||||
};
|
||||
|
||||
# The --production flag disables the devDependencies.
|
||||
yarnFlags = [ "--offline" "--production" ];
|
||||
yarnFlags = [ "--production" ];
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
|
@ -14,7 +14,7 @@ mkYarnPackage rec {
|
||||
packageJSON = ./package.json;
|
||||
yarnLock = ./yarn.lock;
|
||||
yarnNix = ./yarn.nix;
|
||||
yarnFlags = [ "--production" "--offline" ];
|
||||
yarnFlags = [ "--production" ];
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
|
@ -69,7 +69,7 @@ in rec {
|
||||
yarnLock,
|
||||
yarnNix ? mkYarnNix { inherit yarnLock; },
|
||||
offlineCache ? importOfflineCache yarnNix,
|
||||
yarnFlags ? defaultYarnFlags,
|
||||
yarnFlags ? [ ],
|
||||
pkgConfig ? {},
|
||||
preBuild ? "",
|
||||
postBuild ? "",
|
||||
@ -141,7 +141,7 @@ in rec {
|
||||
|
||||
${workspaceDependencyLinks}
|
||||
|
||||
yarn install ${lib.escapeShellArgs yarnFlags}
|
||||
yarn install ${lib.escapeShellArgs (defaultYarnFlags ++ yarnFlags)}
|
||||
|
||||
${lib.concatStringsSep "\n" postInstall}
|
||||
|
||||
@ -241,7 +241,7 @@ in rec {
|
||||
yarnLock ? src + "/yarn.lock",
|
||||
yarnNix ? mkYarnNix { inherit yarnLock; },
|
||||
offlineCache ? importOfflineCache yarnNix,
|
||||
yarnFlags ? defaultYarnFlags,
|
||||
yarnFlags ? [ ],
|
||||
yarnPreBuild ? "",
|
||||
yarnPostBuild ? "",
|
||||
pkgConfig ? {},
|
||||
|
@ -1,7 +1,6 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, fetchpatch
|
||||
, fetchzip
|
||||
, makeWrapper
|
||||
, which
|
||||
, nodejs
|
||||
@ -9,80 +8,44 @@
|
||||
, fetchYarnDeps
|
||||
, python3
|
||||
, nixosTests
|
||||
, buildGoModule
|
||||
}:
|
||||
|
||||
let
|
||||
pinData = lib.importJSON ./pin.json;
|
||||
|
||||
# we need a different version than the one already available in nixpkgs
|
||||
esbuild-hedgedoc = buildGoModule rec {
|
||||
pname = "esbuild";
|
||||
version = "0.12.27";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "evanw";
|
||||
repo = "esbuild";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-UclUTfm6fxoYEEdEEmO/j+WLZLe8SFzt7+Tej4bR0RU=";
|
||||
};
|
||||
|
||||
vendorSha256 = "sha256-QPkBR+FscUc3jOvH7olcGUhM6OW4vxawmNJuRQxPuGs=";
|
||||
};
|
||||
in
|
||||
|
||||
mkYarnPackage rec {
|
||||
pname = "hedgedoc";
|
||||
inherit (pinData) version;
|
||||
version = "1.9.4";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "hedgedoc";
|
||||
repo = "hedgedoc";
|
||||
rev = version;
|
||||
sha256 = pinData.srcHash;
|
||||
# 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-YBPxL1/2bj+8cemSBZSNqSlD/DYJRxSG5UuyUipf3R8=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ which makeWrapper ];
|
||||
extraBuildInputs = [ python3 esbuild-hedgedoc ];
|
||||
extraBuildInputs = [ python3 ];
|
||||
|
||||
packageJSON = ./package.json;
|
||||
yarnFlags = [ "--production" ];
|
||||
|
||||
offlineCache = fetchYarnDeps {
|
||||
inherit yarnLock;
|
||||
sha256 = pinData.yarnHash;
|
||||
yarnLock = src + "/yarn.lock";
|
||||
sha256 = "sha256-tnxubtu2lv5DKYY4rwQzNwvsFu3pD3NF4VUN/xieqpc=";
|
||||
};
|
||||
|
||||
# FIXME(@Ma27) on the bump to 1.9.0 I had to patch this file manually:
|
||||
# I replaced `midi "https://github.com/paulrosen/MIDI.js.git#abcjs"` with
|
||||
# `midi "git+https://github.com/paulrosen/MIDI.js.git#abcjs"` on all occurrences.
|
||||
#
|
||||
# Without this change `yarn` attempted to download the code directly from GitHub, with
|
||||
# the `git+`-prefix it actually uses the `midi.js` version from the offline cache
|
||||
# created by `yarn2nix`. On future bumps this may be necessary as well!
|
||||
yarnLock = ./yarn.lock;
|
||||
packageJSON = ./package.json;
|
||||
|
||||
postConfigure = ''
|
||||
rm deps/HedgeDoc/node_modules
|
||||
cp -R "$node_modules" deps/HedgeDoc
|
||||
chmod -R u+w deps/HedgeDoc
|
||||
configurePhase = ''
|
||||
cp -r "$node_modules" node_modules
|
||||
chmod -R u+w node_modules
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
cd deps/HedgeDoc
|
||||
|
||||
pushd node_modules/sqlite3
|
||||
export CPPFLAGS="-I${nodejs}/include/node"
|
||||
npm run install --build-from-source --nodedir=${nodejs}/include/node
|
||||
popd
|
||||
|
||||
pushd node_modules/esbuild
|
||||
rm bin/esbuild
|
||||
ln -s ${lib.getBin esbuild-hedgedoc}/bin/esbuild bin/
|
||||
popd
|
||||
|
||||
npm run build
|
||||
|
||||
patchShebangs bin/*
|
||||
|
||||
runHook postBuild
|
||||
@ -108,7 +71,6 @@ mkYarnPackage rec {
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
updateScript = ./update.sh;
|
||||
tests = { inherit (nixosTests) hedgedoc; };
|
||||
};
|
||||
|
||||
@ -116,7 +78,7 @@ mkYarnPackage rec {
|
||||
description = "Realtime collaborative markdown notes on all platforms";
|
||||
license = licenses.agpl3;
|
||||
homepage = "https://hedgedoc.org";
|
||||
maintainers = with maintainers; [ willibutz globin ];
|
||||
maintainers = with maintainers; [ willibutz SuperSandro2000 ];
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
||||
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
"version": "1.9.4",
|
||||
"srcHash": "0tOuSVz/b9qYNQppsxREY/emG1F3t5jeEhX4ek7Ktgg=",
|
||||
"yarnHash": "15xakqcgy3amw52p63z9xlbfq2rp6c2ayf46551zx5mnvdp6wz5n"
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -I nixpkgs=../../../../ -i bash -p nix wget prefetch-yarn-deps nix-prefetch-github jq
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
if [ "$#" -gt 1 ] || [[ "$1" == -* ]]; then
|
||||
echo "Regenerates packaging data for the element packages."
|
||||
@ -9,24 +11,16 @@ fi
|
||||
|
||||
version="$1"
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ -z "$version" ]; then
|
||||
version="$(wget -O- "https://api.github.com/repos/hedgedoc/hedgedoc/releases?per_page=1" | jq -r '.[0].tag_name')"
|
||||
fi
|
||||
|
||||
src="https://raw.githubusercontent.com/hedgedoc/hedgedoc/$version"
|
||||
wget "$src/package.json" -O package.json
|
||||
wget "$src/yarn.lock" -O yarn.lock
|
||||
sed 's;midi "https://github\.com/paulrosen/MIDI\.js\.git;midi "git+https://github.com/paulrosen/MIDI.js.git;g' -i yarn.lock
|
||||
|
||||
src_hash=$(nix-prefetch-github hedgedoc hedgedoc --rev ${version} | jq -r .sha256)
|
||||
src_hash=$(nix-prefetch-github hedgedoc hedgedoc --rev "${version}" | jq -r .sha256)
|
||||
yarn_hash=$(prefetch-yarn-deps yarn.lock)
|
||||
|
||||
cat > pin.json << EOF
|
||||
{
|
||||
"version": "$version",
|
||||
"srcHash": "$src_hash",
|
||||
"yarnHash": "$yarn_hash"
|
||||
}
|
||||
EOF
|
||||
sed -i "s/version = \".*\"/version = \"$version\"/" default.nix
|
||||
sed -i "s/hash = \".*\"/hash = \"$src_hash\"/" default.nix
|
||||
sed -i "s/sha256 = \".*\"/sha256 = \"$yarn_hash\"/" default.nix
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -55,9 +55,7 @@ stdenvNoCC.mkDerivation rec {
|
||||
name = "${pname}-modules-${version}";
|
||||
inherit pname version;
|
||||
|
||||
yarnFlags = yarn2nix-moretea.defaultYarnFlags ++ [
|
||||
"--production"
|
||||
];
|
||||
yarnFlags = [ "--production" ];
|
||||
|
||||
pkgConfig = {
|
||||
keytar = {
|
||||
|
Loading…
Reference in New Issue
Block a user