From d8bf0d4859e28ddd23401fbe89f4e528aa09ddb3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 29 Apr 2016 21:04:40 +0200 Subject: Support Git repos in the Nix path E.g. $ nix-build -I nixpkgs=git://github.com/NixOS/nixpkgs '' -A hello This is not extremely useful yet because you can't specify a branch/revision. --- src/libexpr/parser.y | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/libexpr/parser.y') diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y index 20ae1a6960..776e5cb39b 100644 --- a/src/libexpr/parser.y +++ b/src/libexpr/parser.y @@ -520,9 +520,10 @@ formal #include #include -#include -#include -#include +#include "eval.hh" +#include "download.hh" +#include "store-api.hh" +#include "primops/fetchgit.hh" namespace nix { @@ -657,7 +658,11 @@ std::pair EvalState::resolveSearchPathElem(const SearchPathEl if (isUri(elem.second)) { try { - res = { true, makeDownloader()->downloadCached(store, elem.second, true) }; + if (hasPrefix(elem.second, "git://") || hasSuffix(elem.second, ".git")) + // FIXME: support specifying revision/branch + res = { true, exportGit(store, elem.second, "master") }; + else + res = { true, makeDownloader()->downloadCached(store, elem.second, true) }; } catch (DownloadError & e) { printMsg(lvlError, format("warning: Nix search path entry ‘%1%’ cannot be downloaded, ignoring") % elem.second); res = { false, "" }; -- cgit 1.4.1