From 22a47ab03c8a1bf81df3aa0d29a4d6a29aacc36f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 11 Apr 2014 12:50:46 +0200 Subject: [PATCH] Fix building against Nix 1.7 --- default.nix | 7 ++++--- nix-repl.cc | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/default.nix b/default.nix index c4a967bf5..435c16c09 100644 --- a/default.nix +++ b/default.nix @@ -3,11 +3,12 @@ with import nixpkgs { inherit system; }; runCommand "nix-repl" - { buildInputs = [ readline nixUnstable boehmgc ]; } + { buildInputs = [ readline nix boehmgc ]; } '' mkdir -p $out/bin g++ -O3 -Wall -std=c++0x \ -o $out/bin/nix-repl ${./nix-repl.cc} \ - -I${nixUnstable}/include/nix -L${nixUnstable}/lib/nix \ - -lformat -lutil -lstore -lexpr -lmain -lreadline -lgc + -I${nix}/include/nix \ + -lnixformat -lnixutil -lnixstore -lnixexpr -lnixmain -lreadline -lgc \ + -DNIX_VERSION=${(builtins.parseDrvName nix.name).version} '' diff --git a/nix-repl.cc b/nix-repl.cc index 1c7b2f514..ef9be417a 100644 --- a/nix-repl.cc +++ b/nix-repl.cc @@ -323,7 +323,7 @@ bool NixRepl::processLine(string line) but doing it in a child makes it easier to recover from problems / SIGINT. */ if (runProgram("nix-store", Strings{"-r", drvPath}) == 0) { - Derivation drv = parseDerivation(readFile(drvPath)); + Derivation drv = readDerivation(drvPath); std::cout << std::endl << "this derivation produced the following outputs:" << std::endl; foreach (DerivationOutputs::iterator, i, drv.outputs) std::cout << format(" %1% -> %2%") % i->first % i->second.path << std::endl; @@ -494,7 +494,7 @@ std::ostream & NixRepl::printValue(std::ostream & str, Value & v, unsigned int m str << "«derivation "; Bindings::iterator i = v.attrs->find(state.sDrvPath); PathSet context; - Path drvPath = i != v.attrs->end() ? state.coerceToPath(*i->value, context) : "???"; + Path drvPath = i != v.attrs->end() ? state.coerceToPath(*i->pos, *i->value, context) : "???"; str << drvPath << "»"; }