diff --git a/flake.nix b/flake.nix index 2cb9629..80ebd8e 100644 --- a/flake.nix +++ b/flake.nix @@ -45,7 +45,7 @@ fernglas-frontend = final.callPackage ( { lib, stdenv, yarn2nix-moretea, yarn, nodejs-slim }: - stdenv.mkDerivation { + stdenv.mkDerivation (finalDrv: { pname = "fernglas-frontend"; version = self.shortRev or "dirty-${toString self.lastModifiedDate}"; @@ -60,6 +60,9 @@ }; }; + env.FERNGLAS_COMMIT = self.rev or "main"; + env.FERNGLAS_VERSION = finalDrv.version; + offlineCache = let yarnLock = ./frontend/yarn.lock; yarnNix = yarn2nix-moretea.mkYarnNix { inherit yarnLock; }; @@ -91,7 +94,7 @@ mv dist $out runHook postInstall ''; - } + }) ) { }; diff --git a/frontend/webpack.config.js b/frontend/webpack.config.js index f6143f0..fdc381e 100644 --- a/frontend/webpack.config.js +++ b/frontend/webpack.config.js @@ -22,7 +22,17 @@ module.exports = { }, plugins: [ new CopyPlugin({ - patterns: [ "static" ] + patterns: [ + { + from: "static", + transform: (content) => { + return content + .toString() + .replace('#VERSION#', process.env.FERNGLAS_VERSION) + .replace('#COMMIT#', process.env.FERNGLAS_COMMIT); + }, + } + ] }) ] };