Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow any hash function for some git-based fetch* derivations #15139

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
45 changes: 30 additions & 15 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -223,39 +223,54 @@ in

fetchzip = callPackage ../build-support/fetchzip { };

fetchFromGitHub = { owner, repo, rev, sha256, name ? "${repo}-${rev}-src" }: fetchzip {
inherit name sha256;
fetchFromGitHub = {
owner, repo, rev, name ? "${repo}-${rev}-src",
... # For hash agility
}@args: fetchzip ({
inherit name;
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
meta.homepage = "https://github.com/${owner}/${repo}/";
} // { inherit rev; };
} // removeAttrs args [ "owner" "repo" "rev" ]) // { inherit rev; };

fetchFromBitbucket = { owner, repo, rev, sha256, name ? "${repo}-${rev}-src" }: fetchzip {
inherit name sha256;
fetchFromBitbucket = {
owner, repo, rev, name ? "${repo}-${rev}-src",
... # For hash agility
}@args: fetchzip ({
inherit name;
url = "https://bitbucket.org/${owner}/${repo}/get/${rev}.tar.gz";
meta.homepage = "https://bitbucket.org/${owner}/${repo}/";
extraPostFetch = ''rm -f "$out"/.hg_archival.txt''; # impure file; see #12002
};
} // removeAttrs args [ "owner" "repo" "rev" ]) // { inherit rev; };

# cgit example, snapshot support is optional in cgit
fetchFromSavannah = { repo, rev, sha256, name ? "${repo}-${rev}-src" }: fetchzip {
inherit name sha256;
fetchFromSavannah = {
repo, rev, name ? "${repo}-${rev}-src",
... # For hash agility
}@args: fetchzip ({
inherit name;
url = "http://git.savannah.gnu.org/cgit/${repo}.git/snapshot/${repo}-${rev}.tar.gz";
meta.homepage = "http://git.savannah.gnu.org/cgit/${repo}.git/";
};
} // removeAttrs args [ "repo" "rev" ]) // { inherit rev; };

# gitlab example
fetchFromGitLab = { owner, repo, rev, sha256, name ? "${repo}-${rev}-src" }: fetchzip {
inherit name sha256;
fetchFromGitLab = {
owner, repo, rev, name ? "${repo}-${rev}-src",
... # For hash agility
}@args: fetchzip ({
inherit name;
url = "https://gitlab.com/${owner}/${repo}/repository/archive.tar.gz?ref=${rev}";
meta.homepage = "https://gitlab.com/${owner}/${repo}/";
};
} // removeAttrs args [ "owner" "repo" "rev" ]) // { inherit rev; };

# gitweb example, snapshot support is optional in gitweb
fetchFromRepoOrCz = { repo, rev, sha256, name ? "${repo}-${rev}-src" }: fetchzip {
inherit name sha256;
fetchFromRepoOrCz = {
repo, rev, name ? "${repo}-${rev}-src",
... # For hash agility
}@args: fetchzip ({
inherit name;
url = "http://repo.or.cz/${repo}.git/snapshot/${rev}.tar.gz";
meta.homepage = "http://repo.or.cz/${repo}.git/";
};
} // removeAttrs args [ "repo" "rev" ]) // { inherit rev; };

fetchNuGet = callPackage ../build-support/fetchnuget { };
buildDotnetPackage = callPackage ../build-support/build-dotnet-package { };
Expand Down