{ lib, nodejs, stdenv, fetchurl, writeText, git, cacert
, python3
, baseHref ? null
}:

let
  project = import ./yarn-project.nix { inherit lib nodejs stdenv fetchurl writeText git cacert; } {
    src = ./.;
  };
in project.overrideAttrs (oldAttrs: {
  name = "spm-frontend";

  buildInputs = (oldAttrs.buildInputs or []) ++ [ python3 ];

  buildPhase = ''
    yarn build ${lib.optionalString (baseHref != null) "--base-href ${baseHref}"}
  '';

  installPhase = ''
    cp -r dist/spm-frontend $out
  '';
})