Skip to content

Instantly share code, notes, and snippets.

@spacekitteh
Last active March 23, 2017 02:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spacekitteh/64d4e38b4bd9f547710dd81050803263 to your computer and use it in GitHub Desktop.
Save spacekitteh/64d4e38b4bd9f547710dd81050803263 to your computer and use it in GitHub Desktop.
[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
{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;
}
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