forked from mirrors/nixpkgs
fetchurl: allow adding meta info; fetchFrom*: add meta.homepage
The point of this is to be able to do `meta.homepage = src.meta.homepage;` instead of the usual copy-paste for the packages that are hosted on these hosting services.
This commit is contained in:
parent
59ab07351b
commit
bdf32ed2ab
|
@ -76,6 +76,9 @@ in
|
|||
, # If set, don't download the file, but write a list of all possible
|
||||
# URLs (resulting from resolving mirror:// URLs) to $out.
|
||||
showURLs ? false
|
||||
|
||||
, # Meta information, if any.
|
||||
meta ? {}
|
||||
}:
|
||||
|
||||
assert builtins.isList urls;
|
||||
|
@ -120,4 +123,6 @@ if (!hasHash) then throw "Specify hash for fetchurl fixed-output derivation: ${s
|
|||
# Doing the download on a remote machine just duplicates network
|
||||
# traffic, so don't do that.
|
||||
preferLocalBuild = true;
|
||||
|
||||
inherit meta;
|
||||
}
|
||||
|
|
|
@ -370,40 +370,43 @@ let
|
|||
fetchzip = import ../build-support/fetchzip { inherit lib fetchurl unzip; };
|
||||
|
||||
fetchFromGitHub = { owner, repo, rev, sha256, name ? "${repo}-${rev}-src" }: fetchzip {
|
||||
inherit name;
|
||||
inherit name sha256;
|
||||
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
|
||||
inherit sha256;
|
||||
meta.homepage = "https://github.com/${owner}/${repo}/";
|
||||
};
|
||||
|
||||
fetchFromBitbucket = { owner, repo, rev, sha256, name ? "${repo}-${rev}-src" }: fetchzip {
|
||||
inherit name;
|
||||
inherit name sha256;
|
||||
url = "https://bitbucket.org/${owner}/${repo}/get/${rev}.tar.gz";
|
||||
inherit sha256;
|
||||
meta.homepage = "https://bitbucket.org/${owner}/${repo}/";
|
||||
};
|
||||
|
||||
# gitorious example
|
||||
fetchFromGitorious = { owner, repo, rev, sha256, name ? "${repo}-${rev}-src" }: fetchzip {
|
||||
inherit name;
|
||||
inherit name sha256;
|
||||
url = "https://gitorious.org/${owner}/${repo}/archive/${rev}.tar.gz";
|
||||
inherit sha256;
|
||||
meta.homepage = "https://gitorious.org/${owner}/${repo}/";
|
||||
};
|
||||
|
||||
# cgit example, snapshot support is optional in cgit
|
||||
fetchFromSavannah = { repo, rev, sha256, name ? "${repo}-${rev}-src" }: fetchzip {
|
||||
inherit name sha256;
|
||||
url = "http://git.savannah.gnu.org/cgit/${repo}.git/snapshot/${repo}-${rev}.tar.gz";
|
||||
meta.homepage = "http://git.savannah.gnu.org/cgit/${repo}.git/";
|
||||
};
|
||||
|
||||
# gitlab example
|
||||
fetchFromGitLab = { owner, repo, rev, sha256, name ? "${repo}-${rev}-src" }: fetchzip {
|
||||
inherit name sha256;
|
||||
url = "https://gitlab.com/${owner}/${repo}/repository/archive.tar.gz?ref=${rev}";
|
||||
meta.homepage = "https://gitlab.com/${owner}/${repo}/";
|
||||
};
|
||||
|
||||
# gitweb example, snapshot support is optional in gitweb
|
||||
fetchFromRepoOrCz = { repo, rev, sha256, name ? "${repo}-${rev}-src" }: fetchzip {
|
||||
inherit name sha256;
|
||||
url = "http://repo.or.cz/${repo}.git/snapshot/${rev}.tar.gz";
|
||||
meta.homepage = "http://repo.or.cz/${repo}.git/";
|
||||
};
|
||||
|
||||
resolveMirrorURLs = {url}: fetchurl {
|
||||
|
|
Loading…
Reference in a new issue