{ pkgs, ... }:

{
  nixpkgs.overlays = [
    (
      final: prev:
        let
          targetVersion = "1.1.23";
        in
        {
          libmtp =
            if builtins.compareVersions prev.libmtp.version targetVersion >= 0 then
              prev.libmtp
            else
              prev.libmtp.overrideAttrs (_: {
                version = targetVersion;

                src = final.fetchFromGitHub {
                  owner = "libmtp";
                  repo = "libmtp";
                  rev = "v${targetVersion}";
                  hash = "sha256-FlPj9PEeOAWabU11dFTzDgY9TBbgmJclbeL0iULYw6A=";
                };

                patches = [ ];
              });
        }
    )
  ];
}
