mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-12 12:07:47 +03:00
fetchRepoProject: fixes; more options
This commit is contained in:
parent
76e095c6c5
commit
1f545f01bb
@ -1,27 +1,49 @@
|
||||
{stdenv, git, gitRepo, gnupg ? null, cacert}:
|
||||
{ stdenv, git, gitRepo, gnupg ? null, cacert, copyPathsToStore }:
|
||||
|
||||
{name, manifest, rev ? "HEAD", sha256 ? "", repoRepoURL ? "", repoRepoRev ? "", referenceDir ? "",
|
||||
localManifests ? [] }:
|
||||
{ name, manifest, rev ? "HEAD", sha256, repoRepoURL ? "", repoRepoRev ? "", referenceDir ? ""
|
||||
, localManifests ? [], createMirror ? false, useArchive ? !createMirror
|
||||
}:
|
||||
|
||||
assert repoRepoRev != "" -> repoRepoURL != "";
|
||||
assert createMirror -> !useArchive;
|
||||
|
||||
with stdenv.lib;
|
||||
|
||||
let
|
||||
repoInitFlags = [
|
||||
"--manifest-url=${manifest}"
|
||||
"--manifest-branch=${rev}"
|
||||
"--depth=1"
|
||||
#TODO: fetching clone.bundle seems to fail spectacularly inside a sandbox.
|
||||
"--no-clone-bundle"
|
||||
(optionalString (createMirror != "") "--mirror")
|
||||
(optionalString useArchive "--archive")
|
||||
(optionalString (repoRepoURL != "") "--repo-url=${repoRepoURL}")
|
||||
(optionalString (repoRepoRev != "") "--repo-branch=${repoRepoRev}")
|
||||
(optionalString (referenceDir != "") "--reference=${referenceDir}")
|
||||
];
|
||||
|
||||
local_manifests = copyPathsToStore localManifests;
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
buildCommand = with stdenv.lib; ''
|
||||
mkdir ./.repo
|
||||
|
||||
buildCommand = ''
|
||||
mkdir .repo
|
||||
${optionalString (local_manifests != []) ''
|
||||
mkdir ./.repo/local_manifests
|
||||
for local_manifest in ${concatMapStringsSep " " (x: "${x}") localManifests}
|
||||
for local_manifest in ${concatMapStringsSep " " toString local_manifests}
|
||||
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 init ${concatStringsSep " " repoInitFlags}
|
||||
|
||||
repo sync --jobs=$NIX_BUILD_CORES --current-branch
|
||||
rm -rf $out/.repo
|
||||
${optionalString createMirror "rm -rf $out/.repo"}
|
||||
'';
|
||||
|
||||
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||
@ -30,8 +52,7 @@ stdenv.mkDerivation {
|
||||
"GIT_PROXY_COMMAND" "SOCKS_SERVER"
|
||||
];
|
||||
|
||||
buildInputs = [git gitRepo cacert] ++ stdenv.lib.optional (gnupg != null) [gnupg] ;
|
||||
|
||||
buildInputs = [git gitRepo cacert] ++ optional (gnupg != null) [gnupg] ;
|
||||
outputHashAlgo = "sha256";
|
||||
outputHashMode = "recursive";
|
||||
outputHash = sha256;
|
||||
|
Loading…
Reference in New Issue
Block a user