lemmy: fix ui commit_hash path

This commit is contained in:
happysalada 2023-08-27 19:27:40 +08:00 committed by Yt
parent c3ed95307e
commit 676fe5e01b
2 changed files with 9 additions and 1 deletions

View file

@ -160,7 +160,7 @@ in
root * ${cfg.ui.package}/dist root * ${cfg.ui.package}/dist
file_server file_server
} }
handle_path /static/undefined/* { handle_path /static/${cfg.ui.package.passthru.commit_sha}/* {
root * ${cfg.ui.package}/dist root * ${cfg.ui.package}/dist
file_server file_server
} }

View file

@ -55,6 +55,13 @@ mkYarnPackage {
hash = pinData.uiYarnDepsHash; hash = pinData.uiYarnDepsHash;
}; };
patchPhase = ''
substituteInPlace ./package.json \
--replace '$(git rev-parse --short HEAD)' "${src.rev}" \
--replace 'yarn clean' 'yarn --offline clean' \
--replace 'yarn run rimraf dist' 'yarn --offline run rimraf dist'
'';
yarnPreBuild = '' yarnPreBuild = ''
export npm_config_nodedir=${nodejs} export npm_config_nodedir=${nodejs}
''; '';
@ -79,6 +86,7 @@ mkYarnPackage {
passthru.updateScript = ./update.py; passthru.updateScript = ./update.py;
passthru.tests.lemmy-ui = nixosTests.lemmy; passthru.tests.lemmy-ui = nixosTests.lemmy;
passthru.commit_sha = src.rev;
meta = with lib; { meta = with lib; {
description = "Building a federated alternative to reddit in rust"; description = "Building a federated alternative to reddit in rust";