Tried to fix a bunch of missing attr paths

I'm not sure if this is genuinely the case, but fro the CI logs it seems
to me that nur-combined does not actually get used when evaluating
repositories, which was an assumption that I previously had. The current
addition tries it's best to resolve the issue of default.nix not
refering to a local path, but to a derivation in the nix store.
Currently, only gitlab and github links are supported, as smaller git
hosts do not get special treatment from nixpkgs, and thus their
derivation name is not "source"
This commit is contained in:
Erik Oosting 2021-01-12 00:55:00 +01:00
parent 0493dbe793
commit d082944dab

View file

@ -50,11 +50,21 @@ callPackage (nur.repo-sources."%s" + "/%s") {}
prefixes = {
"nixpkgs": "https://github.com/nixos/nixpkgs/tree/master/",
"nur": "https://github.com/nix-community/nur-combined/tree/master/",
# this tends to come up when nur-combined isn't indexed yet
"pkgs": url + "/",
}
stripped = path.parts[4:]
if stripped[0] not in prefixes:
if path.parts[3].endswith("source"):
def url_contains(host: str) -> bool:
return url.find(host) != -1
canonical_url = url
if url_contains("github"):
canonical_url += "/blob"
elif url_contains("gitlab"):
canonical_url += "/-/blob"
attrPath = "/".join(stripped)
location = f"{canonical_url}{attrPath}"
pkg["meta"]["position"] = f"{location}#L{line}"
elif stripped[0] not in prefixes:
print(path, file=sys.stderr)
print(
f"we could not find {stripped} , you can file an issue at https://github.com/nix-community/NUR/issues to the indexing file if you think this is a mistake",
file=sys.stderr,