Last active
March 23, 2017 02:36
-
-
Save spacekitteh/64d4e38b4bd9f547710dd81050803263 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[spacekitteh@spaceserv:~/nix-patches/nixpkgs/pkgs/build-support/fetchgitrepo]$ nix-build test.nix | |
these derivations will be built: | |
/nix/store/dl2ajlh08n7fpbn0rkc78hdylkpsmrn9-foo.drv | |
building path(s) ‘/nix/store/mrsbrb4abqgw0lidbc2bqkw33bab7wd8-foo’ | |
warning: gpg (GnuPG) is not available. | |
warning: Installing it is strongly encouraged. | |
fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle | |
fatal: error [Errno -2] Name or service not known | |
builder for ‘/nix/store/dl2ajlh08n7fpbn0rkc78hdylkpsmrn9-foo.drv’ failed with exit code 1 | |
error: build of ‘/nix/store/dl2ajlh08n7fpbn0rkc78hdylkpsmrn9-foo.drv’ failed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{stdenv, git, gitRepo, gnupg ? null}: | |
{name, manifest, rev ? "HEAD", sha256 ? "", repoRepoURL ? "", repoRepoRev ? "", referenceDir ? "", | |
localManifests ? {} }: | |
assert repoRepoRev != "" -> repoRepoURL != ""; | |
stdenv.mkDerivation { | |
inherit name; | |
buildCommand = with stdenv.lib; '' | |
mkdir -p $out | |
cd $out | |
mkdir $out/.repo | |
export HOME=$out/.repo | |
repo init -u ${manifest} -b ${rev} \ | |
${optionalString (repoRepoURL != "") "--repo-url=${repoRepoURL}"} \ | |
${optionalString (repoRepoRev != "") "--repo-branch=${repoRepoRev}"} \ | |
${optionalString (referenceDir != "") "--reference=${referenceDir}"} \ | |
--depth=1 | |
repo sync --jobs=$NIX_BUILD_CORES --current-branch | |
rm -rf $out/.repo | |
''; | |
buildInputs = [git gitRepo ] ++ | |
stdenv.lib.optional (gnupg != null) [gnupg] ; | |
outputHashAlgo = "sha256"; | |
outputHashMode = "recursive"; | |
outputHash = sha256; | |
impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars; | |
preferLocalBuild = true; | |
inherit manifest rev repoRepoURL repoRepoRev referenceDir; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with import <nixpkgs> {}; | |
let fetcher = import ./default.nix {inherit stdenv | |
git gitRepo gnupg;}; | |
in | |
fetcher { | |
name = "foo"; | |
manifest = "https://github.com/CopperheadOS/platform_manifest.git"; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment