From 676fe5e01b9a41fa14aaa48d87685677664104b1 Mon Sep 17 00:00:00 2001 From: happysalada Date: Sun, 27 Aug 2023 19:27:40 +0800 Subject: [PATCH] lemmy: fix ui commit_hash path --- nixos/modules/services/web-apps/lemmy.nix | 2 +- pkgs/servers/web-apps/lemmy/ui.nix | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/web-apps/lemmy.nix b/nixos/modules/services/web-apps/lemmy.nix index 895f3a9f1b4..20d9dcb7c26 100644 --- a/nixos/modules/services/web-apps/lemmy.nix +++ b/nixos/modules/services/web-apps/lemmy.nix @@ -160,7 +160,7 @@ in root * ${cfg.ui.package}/dist file_server } - handle_path /static/undefined/* { + handle_path /static/${cfg.ui.package.passthru.commit_sha}/* { root * ${cfg.ui.package}/dist file_server } diff --git a/pkgs/servers/web-apps/lemmy/ui.nix b/pkgs/servers/web-apps/lemmy/ui.nix index cd7b1110273..d578fde8e56 100644 --- a/pkgs/servers/web-apps/lemmy/ui.nix +++ b/pkgs/servers/web-apps/lemmy/ui.nix @@ -55,6 +55,13 @@ mkYarnPackage { 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 = '' export npm_config_nodedir=${nodejs} ''; @@ -79,6 +86,7 @@ mkYarnPackage { passthru.updateScript = ./update.py; passthru.tests.lemmy-ui = nixosTests.lemmy; + passthru.commit_sha = src.rev; meta = with lib; { description = "Building a federated alternative to reddit in rust";