core/pkgs/build-support/fetchgithub/default.nix

25 lines
836 B
Nix
Raw Normal View History

2024-06-04 20:22:06 +00:00
{ lib, fetchFromGitForge }:
2024-05-02 00:46:19 +00:00
lib.makeOverridable (
{ owner, repo, rev
, name ? null # Override with null to use the default value
, pname ? "source-${githubBase}-${owner}-${repo}"
2024-05-02 00:46:19 +00:00
, fetchSubmodules ? false, leaveDotGit ? null
, deepClone ? false, private ? false, forceFetchGit ? false
, sparseCheckout ? []
2024-06-04 20:22:06 +00:00
, githubBase ? "github.com"
, passthru ? { }
2024-05-02 00:46:19 +00:00
, meta ? { }
, ... # For hash agility
}@args:
let
baseUrl = "https://${githubBase}/${owner}/${repo}";
gitRepoUrl = "${baseUrl}.git";
2024-06-04 20:22:06 +00:00
url = "${baseUrl}/archive/${rev}.tar.gz";
passthruAttrs = removeAttrs args [ "owner" "repo" "rev" "fetchSubmodules" "forceFetchGit" "githubBase" "varPrefix" ];
2024-05-02 00:46:19 +00:00
in
2024-06-04 20:22:06 +00:00
fetchFromGitForge {
inherit owner repo rev name pname baseUrl gitRepoUrl url fetchSubmodules leaveDotGit deepClone forceFetchGit sparseCheckout passthruAttrs passthru meta;
})