diff options
author | Daniel Peebles <copumpkin@users.noreply.github.com> | 2017-03-23 23:30:07 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-23 23:30:07 -0400 |
commit | a9644fb1f04f736d43c6d665d95fe72891233b88 (patch) | |
tree | 89c74f756f17e6e4b4605e81ba8e0a0b32e0ddd4 /pkgs | |
parent | 306f2c65fe06fe6a8538b8056b7455ade882c044 (diff) | |
parent | 76e095c6c5718d1266e485d07b6d7363cf06492d (diff) |
Merge pull request #24239 from spacekitteh/fetchFromGitRepo
Added fetchRepoProject
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/build-support/fetchrepoproject/default.nix | 42 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 2 |
2 files changed, 44 insertions, 0 deletions
diff --git a/pkgs/build-support/fetchrepoproject/default.nix b/pkgs/build-support/fetchrepoproject/default.nix new file mode 100644 index 0000000000000..f0bc02cf66dfa --- /dev/null +++ b/pkgs/build-support/fetchrepoproject/default.nix @@ -0,0 +1,42 @@ +{stdenv, git, gitRepo, gnupg ? null, cacert}: + +{name, manifest, rev ? "HEAD", sha256 ? "", repoRepoURL ? "", repoRepoRev ? "", referenceDir ? "", +localManifests ? [] }: + +assert repoRepoRev != "" -> repoRepoURL != ""; + +stdenv.mkDerivation { + buildCommand = with stdenv.lib; '' + mkdir ./.repo + mkdir ./.repo/local_manifests + for local_manifest in ${concatMapStringsSep " " (x: "${x}") localManifests} + do + cp $local_manifest ./.repo/local_manifests/$(stripHash $local_manifest; echo $strippedName) + done + + export HOME=.repo + repo init --manifest-url=${manifest} --manifest-branch=${rev} --depth=1 --no-clone-bundle'' + + ${optionalString (repoRepoURL != "") " --repo-url=${repoRepoURL}"} + + ${optionalString (repoRepoRev != "") " --repo-branch=${repoRepoRev}"} + + ${optionalString (referenceDir != "") " --reference=${referenceDir}"} + + '' + repo sync --jobs=$NIX_BUILD_CORES --current-branch + rm -rf $out/.repo + ''; + + GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt"; + + impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars ++ [ + "GIT_PROXY_COMMAND" "SOCKS_SERVER" + ]; + + buildInputs = [git gitRepo cacert] ++ stdenv.lib.optional (gnupg != null) [gnupg] ; + + outputHashAlgo = "sha256"; + outputHashMode = "recursive"; + outputHash = sha256; + + preferLocalBuild = true; + enableParallelBuilding = true; + inherit name cacert manifest rev repoRepoURL repoRepoRev referenceDir; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6b8ae0020a047..b3cf517303d4e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -170,6 +170,8 @@ with pkgs; inherit curl stdenv; }; + fetchRepoProject = callPackage ../build-support/fetchrepoproject { }; + # fetchurlBoot is used for curl and its dependencies in order to # prevent a cyclic dependency (curl depends on curl.tar.bz2, # curl.tar.bz2 depends on fetchurl, fetchurl depends on curl). It |