{ haskellPackages
, stdenv
, fetchFromGitHub
, fetchurl
, haskell
}:

let
  pkg = haskellPackages.callPackage ./generated.nix {};
  webshim = stdenv.mkDerivation rec {
    name = "webshim-${version}";
    version = "1.16.0";
    src = fetchFromGitHub {
      owner = "aFarkas";
      repo = "webshim";
      rev = "1.16.0";
      sha256 = "14pk7hljqipzp0n7vpgcfxr3w4bla57cwyd7bmwmmxrm2zn62cyh";
    };

    installPhase = ''
      mkdir -p $out/js
      cp -r $src/js-webshim/dev/* $out/js/
    '';
  };
  jquery = stdenv.mkDerivation rec {
    name = "jquery-${version}";
    version = "3.3.1";
    src = fetchurl {
      url = "https://github.com/jquery/jquery/archive/${version}.tar.gz";
      sha256 = "1d1pilrwiz0yjx27cd7gbn8qar6hw5zgwjhpsyaijcg52z82wi5q";
    };

    installPhase = ''
      mkdir -p $out/js
      cp -r dist/jquery.js $out/js/
    '';
  };
in stdenv.lib.overrideDerivation pkg (drv: {
  postUnpack = ''
    (
      cd bar-*/static
      rm -rf jquery.js webshim
      ln -vs ${jquery}/js/jquery.js .
      ln -vs ${webshim}/js webshim
    )
  '';
})