From fe16f7d7f91317e087e96089c2a2b9bfe0ab50d0 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 24 Nov 2019 19:58:19 +0000 Subject: [PATCH] fetchFromGitiles: init This has the same motivation as fetchFromGitHub/fetchFromGitLab -- it's cheaper to download a tarball of a single revision than it is to download a whole history. I could have gone with domain/group/repo, like fetchFromGitLab, but it would have made implementation more difficult, and this syntax means it's a drop-in replacement for fetchgit, so I decided it wasn't worth it. --- doc/builders/fetchers.xml | 11 +++++++++++ pkgs/build-support/fetchgitiles/default.nix | 10 ++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 3 files changed, 23 insertions(+) create mode 100644 pkgs/build-support/fetchgitiles/default.nix diff --git a/doc/builders/fetchers.xml b/doc/builders/fetchers.xml index ff398833491..f07c310dcdf 100644 --- a/doc/builders/fetchers.xml +++ b/doc/builders/fetchers.xml @@ -105,6 +105,17 @@ stdenv.mkDerivation { + + + fetchFromGitiles + + + + This is used with Gitiles repositories. The arguments expected + are similar to fetchgit. + + + fetchFromBitbucket diff --git a/pkgs/build-support/fetchgitiles/default.nix b/pkgs/build-support/fetchgitiles/default.nix new file mode 100644 index 00000000000..827680992d6 --- /dev/null +++ b/pkgs/build-support/fetchgitiles/default.nix @@ -0,0 +1,10 @@ +{ fetchzip, lib }: + +{ url, rev, name ? "source", ... } @ args: + +fetchzip ({ + inherit name; + url = "${url}/+archive/${rev}.tar.gz"; + stripRoot = false; + meta.homepage = url; +} // removeAttrs args [ "url" "rev" ]) // { inherit rev; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1730e1436cc..856b4a85b73 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -358,6 +358,8 @@ in fetchFromGitLab = callPackage ../build-support/fetchgitlab {}; + fetchFromGitiles = callPackage ../build-support/fetchgitiles {}; + fetchFromRepoOrCz = callPackage ../build-support/fetchrepoorcz {}; fetchNuGet = callPackage ../build-support/fetchnuget { };