mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-28 01:43:15 +00:00
Merge pull request #231841 from Ma27/wikijs-node18
wiki-js: use nodejs18
This commit is contained in:
commit
fc8c839fe8
@ -133,7 +133,7 @@ in {
|
||||
WorkingDirectory = "/var/lib/${cfg.stateDirectoryName}";
|
||||
DynamicUser = true;
|
||||
PrivateTmp = true;
|
||||
ExecStart = "${pkgs.nodejs_16}/bin/node ${pkgs.wiki-js}/server";
|
||||
ExecStart = "${pkgs.nodejs_18}/bin/node ${pkgs.wiki-js}/server";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ stdenv, fetchurl, lib, nixosTests }:
|
||||
{ stdenv, fetchurl, lib, nixosTests, jq, moreutils }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "wiki-js";
|
||||
@ -9,6 +9,40 @@ stdenv.mkDerivation rec {
|
||||
sha256 = "sha256-O7KQ134zh9ullYyQZimmxfdRwXeHkD8aAhy/pRzIjxo=";
|
||||
};
|
||||
|
||||
# Implements nodejs 18 support as it's not planned to fix this before
|
||||
# the release of v3[1] which is planned to happen in 2023, but not before
|
||||
# NixOS 23.05. However, in the lifespan of 23.05 v16 will get EOLed, so
|
||||
# we have to hack this on our own.
|
||||
#
|
||||
# The problem we fix here is that `exports."/public/"` in a `package.json`
|
||||
# is prohibited, i.e. you cannot export full directories anymore.
|
||||
#
|
||||
# Unfortunately it's non-trivial to fix this because v10 of `extract-files`
|
||||
# (where the problem is fixed) doesn't work for graphql-tools (which depends
|
||||
# on this). Updating this as well is also quite complex because in later
|
||||
# versions the package was split up into multiple smaller packages and
|
||||
# thus a lot of parts of the code-base would need to be changed accordingly.
|
||||
#
|
||||
# Since this is the only breaking change of nodejs 17/18[2][3], this workaround
|
||||
# will be necessary until we can upgrade to v3.
|
||||
#
|
||||
# [1] https://github.com/requarks/wiki/discussions/6388
|
||||
# [2] https://nodejs.org/en/blog/release/v17.0.0
|
||||
# [3] https://nodejs.org/en/blog/release/v18.0.0
|
||||
nativeBuildInputs = [ jq moreutils ];
|
||||
postPatch = ''
|
||||
# Dirty hack to implement nodejs-18 support.
|
||||
<./node_modules/extract-files/package.json jq '
|
||||
# error out loud if the structure has changed and we need to change
|
||||
# this expression
|
||||
if .exports|has("./public/")|not then
|
||||
halt_error(1)
|
||||
else
|
||||
.exports."./public/*" = "./public/*.js" | del(.exports."./public/")
|
||||
end
|
||||
' | sponge ./node_modules/extract-files/package.json
|
||||
'';
|
||||
|
||||
sourceRoot = ".";
|
||||
|
||||
dontBuild = true;
|
||||
|
Loading…
Reference in New Issue
Block a user