Add a utility function "fetchGitHub"

This is a small wrapper around fetchzip. It allows you to say:

  src = fetchGitHub {
    owner = "NixOS";
    repo = "nix";
    rev = "924e19341a5ee488634bc9ce1ea9758ac496afc3"; # or a tag
    sha256 = "1ld1jc26wy0smkg63chvdzsppfw6zy1ykf3mmc50hkx397wcbl09";
  };
This commit is contained in:
Eelco Dolstra 2014-05-08 15:26:42 +02:00
parent c8df888858
commit ebd8573046
3 changed files with 16 additions and 8 deletions

View file

@ -1,12 +1,14 @@
{ stdenv, fetchzip, python, pythonPackages, sysstat, unzip, tornado
{ stdenv, fetchGitHub, python, pythonPackages, sysstat, unzip, tornado
, makeWrapper }:
stdenv.mkDerivation rec {
version = "4.2.1";
name = "dd-agent-${version}";
src = fetchzip {
url = "https://github.com/DataDog/dd-agent/archive/${version}.zip";
src = fetchGitHub {
owner = "DataDog";
repo = "dd-agent";
rev = version;
sha256 = "06f9nkvnpfzs2nw75cac2y9wnp2bay4sg94zz0wjm8886rigjjjm";
};

View file

@ -1,14 +1,15 @@
# XXX: this may need -liconv on non-glibc systems..
{ stdenv, fetchgit, python, perl, autoconf, automake, libtool, intltool, flex }:
{ stdenv, fetchGitHub, python, perl, autoconf, automake, libtool, intltool, flex }:
stdenv.mkDerivation rec {
name = "recode-3.7-pff85fdbd";
name = "recode-3.7-2fd838565";
src = fetchgit {
url = https://github.com/pinard/Recode.git;
src = fetchGitHub {
owner = "pinard";
repo = "Recode";
rev = "2fd8385658e5a08700e3b916053f6680ff85fdbd";
sha256 = "1xhlfmqld6af16l444jli9crj9brym2jihg1n6lkxh2gar68f5l7";
sha256 = "06vyjqaraamcc5vka66mlvxj27ihccqc74aymv2wn8nphr2rhh03";
};
buildInputs = [ python perl autoconf automake libtool intltool flex ];

View file

@ -340,6 +340,11 @@ let
fetchzip = import ../build-support/fetchzip { inherit lib fetchurl unzip; };
fetchGitHub = { owner, repo, rev, sha256 }: fetchzip {
url = "https://github.com/${owner}/${repo}/archive/${rev}.zip";
inherit sha256;
};
resolveMirrorURLs = {url}: fetchurl {
showURLs = true;
inherit url;