How to generate node dependency for a "malformed" yarn.lock?

I have an incomplete derivation like this:

{ pkgs, lib, stdenv, ... }:

  version = "1.16.7";
  yarn2nix = pkgs.haskellPackages.yarn2nix;
  source = pkgs.fetchFromGitHub {
    owner = "prettier";
    repo = "plugin-pug";
    rev = version;
    sha256 = "3sETKw+Vv+SgxyRUEbweD3s24zz9M+UpD6LaSsAIYlk=";
in (stdenv.mkDerivation {
  pname = "prettier-plugin-pug";
  inherit version;
  buildInputs = [ pkgs.nodejs pkgs.git yarn2nix ];
  src = source;

  buildPhase = let
    # ${yarn2nix}/bin/yarn2nix ${source + "/yarn.lock"}
    nodeDependencies = pkgs.runCommand "yarn2nix" { } ''
      ${yarn2nix}/bin/yarn2nix ${source + "/yarn.lock"}
  in ''
    echo ${nodeDependencies}
    ls -a ${nodeDependencies}

  # installPhase = "";

Both pkgs.haskellPackages.yarn2nix and pkgs.yarn2nix returns an error, this is the error I got using pkgs.haskellPackages.yarn2nix:

       > Could not parse /nix/store/q0sssji3gq8vr22pm7dvqyxlal26axwf-source/yarn.lock:
       > ParseError "/nix/store/q0sssji3gq8vr22pm7dvqyxlal26axwf-source/yarn.lock:10:15:\n   |\n10 |   resolution: \"@babel/code-frame@npm:7.12.11\"\n   |               ^\nincorrect indentation (got 15, should be equal to 3)\n"

I tried to clone this project and run npm run build manually, and it is working ok.

So how can I fix this? I think patch might be the answer, but I have to generate the yarn.lock file manually to fix this(And I am not sure if it would work). Is there a more graceful solution?

I ended up forking it and generate one myself. Tedious but at least it works.