#
# Makes Calibre support plugins that need libcrypto.
#
# vim: et:ts=2:sw=2:
#
{ ... }:
let
  overlay = finalPkgs: prevPkgs: {
    calibre = prevPkgs.calibre.overrideAttrs {

      doCheck = false;
      installCheckPhase = "";

      # Also include libcrypto in an accessible path.
      preFixup = ''
        for program in $out/bin/*; do
          wrapProgram $program \
            ''${qtWrapperArgs[@]} \
            ''${gappsWrapperArgs[@]} \
        		--prefix PATH : "${finalPkgs.poppler_utils.out}/bin" \
        		--prefix LD_LIBRARY_PATH : "${finalPkgs.openssl_3_4.out}/lib"
        done
      '';
    };
  };
in
{
  nixpkgs.overlays = [ overlay ];
}
