diff --git a/doc/builders/fetchers.xml b/doc/builders/fetchers.xml
index ff3988334916..f07c310dcdf1 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 000000000000..827680992d69
--- /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 1730e1436cc4..856b4a85b734 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 { };