Skip to content

Commit

Permalink
gotify: 2.0.21 -> 2.1.0
Browse files Browse the repository at this point in the history
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] https://github.com/NixOS/nixpkgs/blob/f007b794c758000a275b00dd0695d2fb155195f0/pkgs/applications/version-management/gitlab/default.nix#L85-L86
[2] facebook/create-react-app#11263
  • Loading branch information
Ma27 committed Oct 1, 2021
1 parent d564673 commit 920474b
Show file tree
Hide file tree
Showing 6 changed files with 3,530 additions and 2,269 deletions.
41 changes: 21 additions & 20 deletions pkgs/servers/gotify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"homepage": ".",
"proxy": "http://localhost:80",
"dependencies": {
"@material-ui/core": "^4.11.0",
"@material-ui/core": "^4.11.4",
"@material-ui/icons": "^4.9.1",
"axios": "^0.20.0",
"codemirror": "^5.57.0",
"detect-browser": "^5.1.1",
"js-base64": "^3.4.5",
"axios": "^0.21.1",
"codemirror": "^5.61.1",
"detect-browser": "^5.2.0",
"js-base64": "^3.6.1",
"mobx": "^5.15.6",
"mobx-react": "^6.3.0",
"mobx-utils": "^5.6.1",
Expand All @@ -20,36 +20,37 @@
"react-codemirror2": "^7.2.1",
"react-dom": "^16.4.2",
"react-infinite": "^0.13.0",
"react-markdown": "^4.0.6",
"react-markdown": "^6.0.2",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-timeago": "^4.1.9",
"react-timeago": "^6.2.1",
"remark-gfm": "^1.0.0",
"remove-markdown": "^0.3.0",
"typeface-roboto": "0.0.75"
"typeface-roboto": "1.1.13"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=node",
"eject": "react-scripts eject",
"lint": "eslint \"src/*.{ts,tsx}\"",
"lint": "eslint \"src/**/*.{ts,tsx}\"",
"format": "prettier \"src/**/*.{ts,tsx}\" --write",
"testformat": "prettier \"src/**/*.{ts,tsx}\" --list-different"
},
"devDependencies": {
"@types/codemirror": "0.0.98",
"@types/codemirror": "5.60.0",
"@types/detect-browser": "^4.0.0",
"@types/get-port": "^4.0.0",
"@types/jest": "^26.0.13",
"@types/js-base64": "^3.0.0",
"@types/node": "^14.10.1",
"@types/jest": "^26.0.23",
"@types/js-base64": "^3.3.1",
"@types/node": "^15.12.2",
"@types/notifyjs": "^3.0.2",
"@types/puppeteer": "^3.0.2",
"@types/puppeteer": "^5.4.3",
"@types/react": "^16.9.49",
"@types/react-dom": "^16.9.8",
"@types/react-infinite": "0.0.35",
"@types/react-router-dom": "^5.1.5",
"@types/remove-markdown": "^0.1.1",
"@types/react-router-dom": "^5.1.7",
"@types/remove-markdown": "^0.3.0",
"@types/rimraf": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^4.1.0",
"@typescript-eslint/parser": "^4.1.0",
Expand All @@ -60,13 +61,13 @@
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-unicorn": "^21.0.0",
"get-port": "^5.1.1",
"prettier": "^2.1.1",
"puppeteer": "^5.3.0",
"react-scripts": "^3.4.3",
"prettier": "^2.3.1",
"puppeteer": "^10.0.0",
"react-scripts": "^4.0.3",
"rimraf": "^3.0.2",
"tree-kill": "^1.2.0",
"typescript": "4.0.2",
"wait-on": "^5.2.0"
"wait-on": "^5.3.0"
},
"eslintConfig": {
"extends": "react-app"
Expand Down
2 changes: 1 addition & 1 deletion pkgs/servers/gotify/source-sha.nix
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"1rb7gmkinp3nwdng3xw2nrim10iw374rwhzlviqgmz87djgajh3l"
"0qqp05258s2ybzbxfklhya8zw9ha9crkxzwls2kfdhndlrdpgznl"
48 changes: 42 additions & 6 deletions pkgs/servers/gotify/ui.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ yarn2nix-moretea
, fetchFromGitHub
, fetchFromGitHub, applyPatches
}:

yarn2nix-moretea.mkYarnPackage rec {
Expand All @@ -10,16 +10,52 @@ yarn2nix-moretea.mkYarnPackage rec {

version = import ./version.nix;

src_all = fetchFromGitHub {
owner = "gotify";
repo = "server";
rev = "v${version}";
sha256 = import ./source-sha.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 ../..
'';

}
2 changes: 1 addition & 1 deletion pkgs/servers/gotify/vendor-sha.nix
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"15y5migjf68fwv21ihkcj3r7mm4cgjbghvwvb9l7mhysnc8kdk8j"
"sha256-ktmJ8rIBYL6/gwYG109sLqo16M0Xgre3wLBTuOTz3CY="
2 changes: 1 addition & 1 deletion pkgs/servers/gotify/version.nix
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"2.0.21"
"2.1.0"
Loading

0 comments on commit 920474b

Please sign in to comment.