Branch: refs/heads/master
Home: https://github.com/NixOS/nix
Commit: 8cf1719e3e02998c0d22ed9e505a4a98e3335627
https://github.com/NixOS/nix/commit/8cf1719e3e02998c0d22ed9e505a4a98e3335627
Author: Eelco Dolstra <[email protected]>
Date: 2012-04-16 (Mon, 16 Apr 2012)
Changed paths:
M scripts/nix-channel.in
M scripts/nix-pull.in
Log Message:
-----------
Hack to prevent accumulation of old manifests
diff --git a/scripts/nix-channel.in b/scripts/nix-channel.in
index 64e5aa0..2bf5e63 100755
--- a/scripts/nix-channel.in
+++ b/scripts/nix-channel.in
@@ -88,6 +88,7 @@ sub update {
my $exprs = "";
foreach my $name (keys %channels) {
my $url = $channels{$name};
+ my $origUrl = $url;
# Check if $url is a redirect. If so, follow it now to ensure
# consistency if the redirection is changed between
@@ -98,6 +99,7 @@ sub update {
$url = $1 if $headers =~ /^Location:\s*(.*)\s*$/m;
# Pull the channel manifest.
+ $ENV{'NIX_ORIG_URL'} = $origUrl;
system("$Nix::Config::binDir/nix-pull", "--skip-wrong-store",
"$url/MANIFEST") == 0
or die "cannot pull manifest from `$url'\n";
diff --git a/scripts/nix-pull.in b/scripts/nix-pull.in
index 084197c..8d5db2f 100755
--- a/scripts/nix-pull.in
+++ b/scripts/nix-pull.in
@@ -72,7 +72,7 @@ sub processURL {
my $urlFile = "$manifestDir/$baseName-$hash.url";
open URL, ">$urlFile" or die "cannot create `$urlFile'";
- print URL "$url";
+ print URL ($ENV{'NIX_ORIG_URL'} || $url);
close URL;
my $finalPath = "$manifestDir/$baseName-$hash.nixmanifest";
================================================================
Commit: 8745fade0387b2900a98b95798d9f12be7ef97ca
https://github.com/NixOS/nix/commit/8745fade0387b2900a98b95798d9f12be7ef97ca
Author: Eelco Dolstra <[email protected]>
Date: 2012-04-17 (Tue, 17 Apr 2012)
Changed paths:
M doc/manual/nix-instantiate.xml
M src/nix-instantiate/nix-instantiate.cc
Log Message:
-----------
Added utility command ‘nix-instantiate --find-file’ to look up a file in
Nix's search path
diff --git a/doc/manual/nix-instantiate.xml b/doc/manual/nix-instantiate.xml
index a659ee7..7e61208 100644
--- a/doc/manual/nix-instantiate.xml
+++ b/doc/manual/nix-instantiate.xml
@@ -36,6 +36,7 @@
<option>--eval-only</option>
<arg><option>--strict</option></arg>
</arg>
+ <arg choice='plain'><option>--find-file</option></arg>
</group>
<arg><option>--xml</option></arg>
</arg>
@@ -100,6 +101,19 @@ policies.</para>
</varlistentry>
+ <varlistentry><term><option>--find-file</option></term>
+
+ <listitem><para>Look up the given files in Nix’s search path (as
+ specified by the <envar>NIX_PATH</envar> environment variable).
+ If found, print the corresponding absolute paths on standard
+ output. For instance, if <envar>NIX_PATH</envar> is
+ <literal>nixpkgs=/home/alice/nixpkgs</literal>, then
+ <literal>nix-instantiate --find-file nixpkgs/default.nix</literal>
+ will print
+ <literal>/home/alice/nixpkgs/default.nix</literal>.</para></listitem>
+
+ </varlistentry>
+
<varlistentry><term><option>--xml</option></term>
<listitem><para>When used with <option>--parse-only</option> and
diff --git a/src/nix-instantiate/nix-instantiate.cc
b/src/nix-instantiate/nix-instantiate.cc
index 8f3a290..adc8ca6 100644
--- a/src/nix-instantiate/nix-instantiate.cc
+++ b/src/nix-instantiate/nix-instantiate.cc
@@ -79,6 +79,7 @@ void run(Strings args)
EvalState state;
Strings files;
bool readStdin = false;
+ bool findFile = false;
bool evalOnly = false;
bool parseOnly = false;
bool xmlOutput = false;
@@ -100,6 +101,8 @@ void run(Strings args)
readOnlyMode = true;
parseOnly = evalOnly = true;
}
+ else if (arg == "--find-file")
+ findFile = true;
else if (arg == "--attr" || arg == "-A") {
if (i == args.end())
throw UsageError("`--attr' requires an argument");
@@ -130,6 +133,15 @@ void run(Strings args)
if (attrPaths.empty()) attrPaths.push_back("");
+ if (findFile) {
+ foreach (Strings::iterator, i, files) {
+ Path p = state.findFile(*i);
+ if (p == "") throw Error(format("unable to find `%1%'") % *i);
+ std::cout << p << std::endl;
+ }
+ return;
+ }
+
store = openStore();
if (readStdin) {
================================================================
Commit: 9cd3ff1059e9daffe65e24dc826268f1e69e2593
https://github.com/NixOS/nix/commit/9cd3ff1059e9daffe65e24dc826268f1e69e2593
Author: Eelco Dolstra <[email protected]>
Date: 2012-04-17 (Tue, 17 Apr 2012)
Changed paths:
M doc/manual/nix-instantiate.xml
M src/nix-instantiate/nix-instantiate.cc
Log Message:
-----------
nix-instantiate: default to "default.nix" if no arguments are given
diff --git a/doc/manual/nix-instantiate.xml b/doc/manual/nix-instantiate.xml
index 7e61208..618b61f 100644
--- a/doc/manual/nix-instantiate.xml
+++ b/doc/manual/nix-instantiate.xml
@@ -50,8 +50,9 @@
<para>The command <command>nix-instantiate</command> generates <link
linkend="gloss-derivation">store derivations</link> from (high-level)
Nix expressions. It loads and evaluates the Nix expressions in each
-of <replaceable>files</replaceable>. Each top-level expression should
-evaluate to a derivation, a list of derivations, or a set of
+of <replaceable>files</replaceable> (which defaults to
+<replaceable>./default.nix</replaceable>). Each top-level expression
+should evaluate to a derivation, a list of derivations, or a set of
derivations. The paths of the resulting store derivations are printed
on standard output.</para>
diff --git a/src/nix-instantiate/nix-instantiate.cc
b/src/nix-instantiate/nix-instantiate.cc
index adc8ca6..d86c9fc 100644
--- a/src/nix-instantiate/nix-instantiate.cc
+++ b/src/nix-instantiate/nix-instantiate.cc
@@ -148,7 +148,8 @@ void run(Strings args)
Expr * e = parseStdin(state);
processExpr(state, attrPaths, parseOnly, strict, autoArgs,
evalOnly, xmlOutput, xmlOutputSourceLocation, e);
- }
+ } else if (files.empty())
+ files.push_back("./default.nix");
foreach (Strings::iterator, i, files) {
Expr * e = state.parseExprFromFile(lookupFileArg(state, *i));
================================================================
Compare: https://github.com/NixOS/nix/compare/1132dd2...9cd3ff1
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits