diff options
Diffstat (limited to 'pkgs/build-support/fetchgithub/default.nix')
-rw-r--r-- | pkgs/build-support/fetchgithub/default.nix | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/pkgs/build-support/fetchgithub/default.nix b/pkgs/build-support/fetchgithub/default.nix index 4e4162368b9..27cb8312ea0 100644 --- a/pkgs/build-support/fetchgithub/default.nix +++ b/pkgs/build-support/fetchgithub/default.nix @@ -5,10 +5,23 @@ , deepClone ? false, private ? false, forceFetchGit ? false , sparseCheckout ? "" , githubBase ? "github.com", varPrefix ? null +, meta ? { } , ... # For hash agility }@args: + let + + position = (if args.meta.description or null != null + then builtins.unsafeGetAttrPos "description" args.meta + else builtins.unsafeGetAttrPos "rev" args + ); baseUrl = "https://${githubBase}/${owner}/${repo}"; + newMeta = meta // { + homepage = meta.homepage or baseUrl; + + # to indicate where derivation originates, similar to make-derivation.nix's mkDerivation + position = "${position.file}:${toString position.line}"; + }; passthruAttrs = removeAttrs args [ "owner" "repo" "rev" "fetchSubmodules" "forceFetchGit" "private" "githubBase" "varPrefix" ]; varBase = "NIX${if varPrefix == null then "" else "_${varPrefix}"}_GITHUB_PRIVATE_"; useFetchGit = fetchSubmodules || (leaveDotGit == true) || deepClone || forceFetchGit || (sparseCheckout != ""); @@ -37,4 +50,4 @@ let ) // privateAttrs // passthruAttrs // { inherit name; }; in -fetcher fetcherArgs // { meta.homepage = baseUrl; inherit rev; } +fetcher fetcherArgs // { meta = newMeta; inherit rev; } |