I am trying to generate nix code to fetch programs from different types of url:
git://github.com/antirez/lua-cmsgpack.git or http://program.com/0.4.tar.gz
Iam looking for a program that would convert the input git://github.com/antirez/lua-cmsgpack.git
into
builtins.fetchGit {
"url": "git://github.com/antirez/lua-cmsgpack.git",
"rev": "57b1f90cf6cec46450e87289ed5a676165d31071",
"date": "2018-06-14T11:56:56+02:00",
"sha256": "0yiwl4p1zh9qid3ksc4n9fv5bwaa9vjb0vgwnkars204xmxdj8fj",
"fetchSubmodules": false
}
and http://program.com/0.4.tar.gz
into fetchurl { url = http://program.com/0.4.tar.gz; sha256 = ... }
In the first example, I can run nix-prefetch-git --quiet git://github.com/antirez/lua-cmsgpack.git
but it still means that I detected in advance it was a git url. I am looking for a more holistic program that detects the protocol / domain and depending on those generate the appropriate fetch instructions like fetchFromGithub or fetchFromGitlab or fetchurl.
Is there anything like it available ?