From bdf32ed2ab1ed0f627a6217d85be942763c2bb1a Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Sun, 24 May 2015 13:52:12 +0000 Subject: [PATCH] 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. --- pkgs/build-support/fetchurl/default.nix | 5 +++++ pkgs/top-level/all-packages.nix | 15 +++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/pkgs/build-support/fetchurl/default.nix b/pkgs/build-support/fetchurl/default.nix index 0d7534e67587..b1dc6e7be31b 100644 --- a/pkgs/build-support/fetchurl/default.nix +++ b/pkgs/build-support/fetchurl/default.nix @@ -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; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b43fb9c78961..20d7fa23403f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 {