Unverified Commit 02497f83 authored by Sizhe Zhao's avatar Sizhe Zhao
Browse files

fava: build frontend from source

parent ea7b7674
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
--- a/_build_backend.py
+++ b/_build_backend.py
@@ -87,7 +87,7 @@
 
 def _build_fava() -> None:
     """Run the build steps for Fava."""
-    _compile_frontend()
+    # _compile_frontend()
     _compile_translations()
 
 
+32 −6
Original line number Diff line number Diff line
{
  lib,
  python3Packages,
  fetchPypi,
  buildNpmPackage,
  fetchFromGitHub,
  stdenv,
}:
let
  src = buildNpmPackage (finalAttrs: {
    pname = "fava-frontend";
    version = "1.30.5";

    src = fetchFromGitHub {
      owner = "beancount";
      repo = "fava";
      tag = "v${finalAttrs.version}";
      hash = "sha256-46ze+1sdgXq9Unhu1ec4buXbH3s/PCcfCx+rmYc+fZw=";
    };
    sourceRoot = "${finalAttrs.src.name}/frontend";

python3Packages.buildPythonApplication rec {
    npmDepsHash = "sha256-ImBNqccAd61c9ASzklcooQyh7BYdgJW9DTcQRmFHqho=";
    makeCacheWritable = true;

    preBuild = ''
      chmod -R u+w ..
    '';

    installPhase = ''
      runHook preInstall
      cp -R .. $out
      runHook postInstall
    '';
  });
in
python3Packages.buildPythonApplication {
  pname = "fava";
  version = "1.30.5";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-pfnRNhAcyuYFHqPBF0qCrK7w1PJiMOdYXCGj+xXi6uQ=";
  };
  inherit src;

  patches = [ ./dont-compile-frontend.patch ];

  postPatch = ''
    substituteInPlace tests/test_cli.py \