mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 09:23:01 +00:00
920474b7f7
ChangeLog: https://github.com/gotify/server/releases/tag/v2.0.22
ChangeLog: https://github.com/gotify/server/releases/tag/v2.0.23
ChangeLog: https://github.com/gotify/server/releases/tag/v2.1.0
While the update only contains a few small features and a few bugfixes,
the change was rather messy for us unfortunately:
* It seems as if `npmjs.org`-packages can't be transformed into
`pkg___pkg-x.y.z` for Yarn's offline cache. The name
`https___registry.npmjs.org_caniuse_lite___caniuse_lite_1.0.30001237.tgz`
isn't the problem because when changing the URL "parser" of `yarn2nix`
to transform this into `org_caniuse_lite___caniuse_lite_1.0.30001237`
this doesn't help either.
Instead, I derived the fix from `gitlab`[1] where `yarn.lock` gets
patched to make sure that it detects the package in the offline-cache
properly.
* The frontend is now built with `react-scripts`. This is a problem for
us because it tries to write into `node_modules/.cache` even though
`node_modules` is a store-path in the context of `yarn2nix`[2].
The change isn't pretty, but solves the issue for us.
[1] f007b794c7/pkgs/applications/version-management/gitlab/default.nix (L85-L86)
[2] https://github.com/facebook/create-react-app/issues/11263
62 lines
1.7 KiB
Nix
62 lines
1.7 KiB
Nix
{ yarn2nix-moretea
|
|
, fetchFromGitHub, applyPatches
|
|
}:
|
|
|
|
yarn2nix-moretea.mkYarnPackage rec {
|
|
pname = "gotify-ui";
|
|
|
|
packageJSON = ./package.json;
|
|
yarnNix = ./yarndeps.nix;
|
|
|
|
version = import ./version.nix;
|
|
|
|
src_all = applyPatches {
|
|
src = fetchFromGitHub {
|
|
owner = "gotify";
|
|
repo = "server";
|
|
rev = "v${version}";
|
|
sha256 = import ./source-sha.nix;
|
|
};
|
|
postPatch = ''
|
|
substituteInPlace ui/yarn.lock \
|
|
--replace \
|
|
"https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001237.tgz" \
|
|
"https___registry.npmjs.org_caniuse_lite___caniuse_lite_1.0.30001237.tgz"
|
|
'';
|
|
};
|
|
src = "${src_all}/ui";
|
|
|
|
buildPhase = ''
|
|
export HOME=$(mktemp -d)
|
|
export WRITABLE_NODE_MODULES="$(pwd)/tmp"
|
|
mkdir -p "$WRITABLE_NODE_MODULES"
|
|
|
|
# react-scripts requires a writable node_modules/.cache, so we have to copy the symlink's contents back
|
|
# into `node_modules/`.
|
|
# See https://github.com/facebook/create-react-app/issues/11263
|
|
cd deps/gotify-ui
|
|
node_modules="$(readlink node_modules)"
|
|
rm node_modules
|
|
mkdir -p "$WRITABLE_NODE_MODULES"/.cache
|
|
cp -r $node_modules/* "$WRITABLE_NODE_MODULES"
|
|
|
|
# In `node_modules/.bin` are relative symlinks that would be broken after copying them over,
|
|
# so we take care of them here.
|
|
mkdir -p "$WRITABLE_NODE_MODULES"/.bin
|
|
for x in "$node_modules"/.bin/*; do
|
|
ln -sfv "$node_modules"/.bin/"$(readlink "$x")" "$WRITABLE_NODE_MODULES"/.bin/"$(basename "$x")"
|
|
done
|
|
|
|
ln -sfv "$WRITABLE_NODE_MODULES" node_modules
|
|
cd ../..
|
|
|
|
yarn build
|
|
|
|
cd deps/gotify-ui
|
|
rm -rf node_modules
|
|
ln -sf $node_modules node_modules
|
|
cd ../..
|
|
'';
|
|
|
|
}
|