Compare commits
18
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d52180455 | ||
|
|
64ea7cc437 | ||
|
|
939cf4cceb | ||
|
|
4a000cbb39 | ||
|
|
e89d02bf03 | ||
|
|
05cb8e5c5a | ||
|
|
14ca85688c | ||
|
|
8a5da93841 | ||
|
|
77e9e1ed91 | ||
|
|
24ec750003 | ||
|
|
9432f3fb7d | ||
|
|
ab435463d0 | ||
|
|
bd94e63853 | ||
|
|
d9d8a84a96 | ||
|
|
64e486ab63 | ||
|
|
39b4177500 | ||
|
|
2691d51a33 | ||
|
|
b6dec2f3ca |
No files matched your search
@@ -35,14 +35,14 @@
|
||||
available paths from the installation medium. The replacement is
|
||||
to use a chroot store as a substituter
|
||||
(e.g. <literal>--substituters /mnt</literal>), or to build into a
|
||||
chroot store (e.g. <literal>--store /mnt --substituter /</literal>).</para>
|
||||
chroot store (e.g. <literal>--store /mnt --substituters /</literal>).</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>The command <command>nix-push</command> has been removed as
|
||||
part of the effort to eliminate Nix's dependency on Perl. You can
|
||||
use <command>nix copy</command> instead, e.g. <literal>nix copy
|
||||
--to /tmp/my-binary-cache <replaceable>paths…</replaceable></literal></para>
|
||||
--to file:///tmp/my-binary-cache <replaceable>paths…</replaceable></literal></para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
@@ -323,13 +323,12 @@
|
||||
|
||||
<listitem>
|
||||
<para><command>nix sign-paths</command> signs store
|
||||
paths. (TODO: add examples)</para>
|
||||
paths.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para><command>nix copy-sigs</command> copies signatures from
|
||||
one store to another. (TODO: add examples and
|
||||
tests)</para>
|
||||
one store to another.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
@@ -460,7 +459,7 @@
|
||||
secret keys specified by the <option>secret-key-files</option>
|
||||
store option. Secret/public key pairs can be generated using
|
||||
<command>nix-store
|
||||
--generate-binary-cache-key</command>. (TODO: rename)</para>
|
||||
--generate-binary-cache-key</command>.</para>
|
||||
|
||||
<para>In addition, locally-built store paths are marked as
|
||||
“ultimately trusted”, but this bit is not propagated when
|
||||
@@ -537,7 +536,7 @@
|
||||
xlink:href="https://github.com/NixOS/nix/commit/8bdf83f936adae6f2c907a6d2541e80d4120f051">no
|
||||
longer</link> a fatal error if build rounds produce different
|
||||
output. Also, a hook named <option>diff-hook</option> is <link
|
||||
xlink:href="https://github.com/NixOS/nix/commit/9a313469a4bdea2d1e8df24d16289dc2a172a169w">provided</link>
|
||||
xlink:href="https://github.com/NixOS/nix/commit/9a313469a4bdea2d1e8df24d16289dc2a172a169">provided</link>
|
||||
to allow you to run tools such as <command>diffoscope</command>
|
||||
when build rounds produce different output.</para>
|
||||
</listitem>
|
||||
@@ -723,8 +722,7 @@ configureFlags = "--prefix=${placeholder "out"} --includedir=${placeholder "dev"
|
||||
|
||||
will cause the <envar>configureFlags</envar> environment variable
|
||||
to contain the actual store paths corresponding to the
|
||||
<literal>out</literal> and <literal>dev</literal> outputs. TODO:
|
||||
add docs.</para>
|
||||
<literal>out</literal> and <literal>dev</literal> outputs.</para>
|
||||
</listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
@@ -6,6 +6,7 @@ use Data::Dumper;
|
||||
use File::Basename;
|
||||
use File::Path;
|
||||
use File::Slurp;
|
||||
use File::Copy;
|
||||
use JSON::PP;
|
||||
use LWP::UserAgent;
|
||||
|
||||
@@ -54,7 +55,7 @@ sub downloadFile {
|
||||
|
||||
my $buildInfo = decode_json(fetch("$evalUrl/job/$jobName", 'application/json'));
|
||||
|
||||
my $srcFile = $buildInfo->{buildproducts}->{$productNr}->{path} or die;
|
||||
my $srcFile = $buildInfo->{buildproducts}->{$productNr}->{path} or die "job '$jobName' lacks product $productNr\n";
|
||||
$dstName //= basename($srcFile);
|
||||
my $dstFile = "$releaseDir/" . $dstName;
|
||||
|
||||
@@ -78,9 +79,8 @@ sub downloadFile {
|
||||
return ($dstFile, $sha256_expected);
|
||||
}
|
||||
|
||||
downloadFile("tarball", "2"); # PDF
|
||||
downloadFile("tarball", "3"); # .tar.bz2
|
||||
my ($tarball, $tarballHash) = downloadFile("tarball", "4"); # .tar.xz
|
||||
downloadFile("tarball", "2"); # .tar.bz2
|
||||
my ($tarball, $tarballHash) = downloadFile("tarball", "3"); # .tar.xz
|
||||
my ($tarball_i686_linux, $tarball_i686_linux_hash) = downloadFile("binaryTarball.i686-linux", "1");
|
||||
my ($tarball_x86_64_linux, $tarball_x86_64_linux_hash) = downloadFile("binaryTarball.x86_64-linux", "1");
|
||||
my ($tarball_aarch64_linux, $tarball_aarch64_linux_hash) = downloadFile("binaryTarball.aarch64-linux", "1");
|
||||
@@ -152,4 +152,9 @@ write_file("$siteDir/nix-release.tt",
|
||||
|
||||
system("cd $siteDir && nix-shell --run 'make nix/install nix/install.sig'") == 0 or die;
|
||||
|
||||
copy("$siteDir/nix/install", "$siteDir/nix/install-$version") or die;
|
||||
copy("$siteDir/nix/install.sig", "$siteDir/nix/install-$version.sig") or die;
|
||||
|
||||
system("cd $siteDir && git add nix/install-$version nix/install-$version.sig") == 0 or die;
|
||||
|
||||
system("cd $siteDir && git commit -a -m 'Nix $version released'") == 0 or die;
|
||||
@@ -4,6 +4,8 @@
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>org.nixos.nix-daemon</string>
|
||||
<key>KeepAlive</key>
|
||||
<true/>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>Program</key>
|
||||
|
||||
@@ -74,10 +74,10 @@ static void createLinks(const Path & srcDir, const Path & dstDir, int priority)
|
||||
auto prevPriority = priorities[dstFile];
|
||||
if (prevPriority == priority)
|
||||
throw Error(format(
|
||||
"Packages '%1%' and '%2%' have the same priority '%3%'"
|
||||
"packages '%1%' and '%2%' have the same priority %3%; "
|
||||
"use 'nix-env --set-flag priority NUMBER INSTALLED_PKGNAME' "
|
||||
"to change the priority of one of the conflicting packages"
|
||||
" ('0' being the highest priority)"
|
||||
" (0 being the highest priority)"
|
||||
) % srcFile % target % priority);
|
||||
if (prevPriority < priority)
|
||||
continue;
|
||||
|
||||
+18
-1
@@ -313,7 +313,7 @@ EvalState::EvalState(const Strings & _searchPath, ref<Store> store)
|
||||
for (auto & i : _searchPath) addToSearchPath(i);
|
||||
for (auto & i : paths) addToSearchPath(i);
|
||||
}
|
||||
addToSearchPath("nix=" + canonPath(settings.nixDataDir + "/nix/corepkgs"));
|
||||
addToSearchPath("nix=" + canonPath(settings.nixDataDir + "/nix/corepkgs", true));
|
||||
|
||||
if (settings.restrictEval || settings.pureEval) {
|
||||
allowedPaths = PathSet();
|
||||
@@ -1386,6 +1386,23 @@ void ExprPos::eval(EvalState & state, Env & env, Value & v)
|
||||
}
|
||||
|
||||
|
||||
void ExprInclude::eval(EvalState & state, Env & env, Value & v)
|
||||
{
|
||||
Value vPath;
|
||||
path->eval(state, env, vPath);
|
||||
|
||||
PathSet context;
|
||||
auto realPath = state.checkSourcePath(
|
||||
state.toRealPath(state.coerceToPath(pos, vPath, context), context));
|
||||
|
||||
printTalkative("including file '%1%'", realPath);
|
||||
|
||||
auto e = state.parseExprFromFile(resolveExprPath(realPath), *staticEnv);
|
||||
|
||||
e->eval(state, env, v);
|
||||
}
|
||||
|
||||
|
||||
void EvalState::forceValueDeep(Value & v)
|
||||
{
|
||||
std::set<const Value *> seen;
|
||||
|
||||
@@ -109,6 +109,7 @@ in { return IN; }
|
||||
rec { return REC; }
|
||||
inherit { return INHERIT; }
|
||||
or { return OR_KW; }
|
||||
include { return INCLUDE; }
|
||||
\.\.\. { return ELLIPSIS; }
|
||||
|
||||
\=\= { return EQ; }
|
||||
|
||||
@@ -191,6 +191,11 @@ void ExprPos::show(std::ostream & str)
|
||||
str << "__curPos";
|
||||
}
|
||||
|
||||
void ExprInclude::show(std::ostream & str)
|
||||
{
|
||||
str << "(include " << *path << ")";
|
||||
}
|
||||
|
||||
|
||||
std::ostream & operator << (std::ostream & str, const Pos & pos)
|
||||
{
|
||||
@@ -402,6 +407,24 @@ void ExprPos::bindVars(const StaticEnv & env)
|
||||
{
|
||||
}
|
||||
|
||||
void ExprInclude::bindVars(const StaticEnv & env)
|
||||
{
|
||||
path->bindVars(env);
|
||||
|
||||
/* Copy the static environment so that ExprInclude::eval() can
|
||||
pass it to parseExprFromFile(). FIXME: if there are many uses
|
||||
of 'include' in the same scope, we should cache this. */
|
||||
|
||||
const StaticEnv * srcEnv = &env;
|
||||
StaticEnv * * dstEnv = &staticEnv;
|
||||
|
||||
while (srcEnv) {
|
||||
*dstEnv = new StaticEnv(*srcEnv);
|
||||
srcEnv = srcEnv->up;
|
||||
dstEnv = (StaticEnv * *) &(*dstEnv)->up;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Storing function names. */
|
||||
|
||||
|
||||
+12
-3
@@ -86,9 +86,9 @@ struct Expr
|
||||
std::ostream & operator << (std::ostream & str, Expr & e);
|
||||
|
||||
#define COMMON_METHODS \
|
||||
void show(std::ostream & str); \
|
||||
void eval(EvalState & state, Env & env, Value & v); \
|
||||
void bindVars(const StaticEnv & env);
|
||||
void show(std::ostream & str) override; \
|
||||
void eval(EvalState & state, Env & env, Value & v) override; \
|
||||
void bindVars(const StaticEnv & env) override;
|
||||
|
||||
struct ExprInt : Expr
|
||||
{
|
||||
@@ -326,6 +326,15 @@ struct ExprPos : Expr
|
||||
COMMON_METHODS
|
||||
};
|
||||
|
||||
struct ExprInclude : Expr
|
||||
{
|
||||
Pos pos;
|
||||
Expr * path;
|
||||
StaticEnv * staticEnv;
|
||||
ExprInclude(const Pos & pos, Expr * path) : pos(pos), path(path) { };
|
||||
COMMON_METHODS
|
||||
};
|
||||
|
||||
|
||||
/* Static environments are used to map variable names onto (level,
|
||||
displacement) pairs used to obtain the value of the variable at
|
||||
|
||||
@@ -270,7 +270,7 @@ void yyerror(YYLTYPE * loc, yyscan_t scanner, ParseData * data, const char * err
|
||||
%token <nf> FLOAT
|
||||
%token <path> PATH HPATH SPATH
|
||||
%token <uri> URI
|
||||
%token IF THEN ELSE ASSERT WITH LET IN REC INHERIT EQ NEQ AND OR IMPL OR_KW
|
||||
%token IF THEN ELSE ASSERT WITH LET IN REC INHERIT EQ NEQ AND OR IMPL OR_KW INCLUDE
|
||||
%token DOLLAR_CURLY /* == ${ */
|
||||
%token IND_STRING_OPEN IND_STRING_CLOSE
|
||||
%token ELLIPSIS
|
||||
@@ -348,6 +348,7 @@ expr_app
|
||||
: expr_app expr_select
|
||||
{ $$ = new ExprApp(CUR_POS, $1, $2); }
|
||||
| expr_select { $$ = $1; }
|
||||
| INCLUDE expr_select { $$ = new ExprInclude(CUR_POS, $2); }
|
||||
;
|
||||
|
||||
expr_select
|
||||
|
||||
+15
-4
@@ -1913,21 +1913,32 @@ static void prim_replaceStrings(EvalState & state, const Pos & pos, Value * * ar
|
||||
auto s = state.forceString(*args[2], context, pos);
|
||||
|
||||
string res;
|
||||
for (size_t p = 0; p < s.size(); ) {
|
||||
// Loops one past last character to handle the case where 'from' contains an empty string.
|
||||
for (size_t p = 0; p <= s.size(); ) {
|
||||
bool found = false;
|
||||
auto i = from.begin();
|
||||
auto j = to.begin();
|
||||
for (; i != from.end(); ++i, ++j)
|
||||
if (s.compare(p, i->size(), *i) == 0) {
|
||||
found = true;
|
||||
p += i->size();
|
||||
res += j->first;
|
||||
if (i->empty()) {
|
||||
if (p < s.size())
|
||||
res += s[p];
|
||||
p++;
|
||||
} else {
|
||||
p += i->size();
|
||||
}
|
||||
for (auto& path : j->second)
|
||||
context.insert(path);
|
||||
j->second.clear();
|
||||
break;
|
||||
}
|
||||
if (!found) res += s[p++];
|
||||
if (!found) {
|
||||
if (p < s.size())
|
||||
res += s[p];
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
mkString(v, res, context);
|
||||
@@ -2225,7 +2236,7 @@ void EvalState::createBaseEnv()
|
||||
|
||||
/* Add a wrapper around the derivation primop that computes the
|
||||
`drvPath' and `outPath' attributes lazily. */
|
||||
string path = settings.nixDataDir + "/nix/corepkgs/derivation.nix";
|
||||
string path = canonPath(settings.nixDataDir + "/nix/corepkgs/derivation.nix", true);
|
||||
sDerivationNix = symbols.create(path);
|
||||
evalFile(path, v);
|
||||
addConstant("derivation", v);
|
||||
|
||||
@@ -79,7 +79,7 @@ GitInfo exportGit(ref<Store> store, const std::string & uri,
|
||||
ref = "HEAD"s;
|
||||
}
|
||||
|
||||
if (!ref) ref = "master"s;
|
||||
if (!ref) ref = "HEAD"s;
|
||||
|
||||
if (rev != "" && !std::regex_match(rev, revRegex))
|
||||
throw Error("invalid Git revision '%s'", rev);
|
||||
|
||||
@@ -717,7 +717,7 @@ Path Downloader::downloadCached(ref<Store> store, const string & url_, bool unpa
|
||||
Path tmpDir = createTempDir();
|
||||
AutoDelete autoDelete(tmpDir, true);
|
||||
// FIXME: this requires GNU tar for decompression.
|
||||
runProgram("tar", true, {"xf", storePath, "-C", tmpDir, "--strip-components", "1"});
|
||||
runProgram("tar", true, {"xf", store->toRealPath(storePath), "-C", tmpDir, "--strip-components", "1"});
|
||||
unpackedStorePath = store->addToStore(name, tmpDir, true, htSHA256, defaultPathFilter, NoRepair);
|
||||
}
|
||||
replaceSymlink(unpackedStorePath, unpackedLink);
|
||||
@@ -727,7 +727,7 @@ Path Downloader::downloadCached(ref<Store> store, const string & url_, bool unpa
|
||||
if (expectedStorePath != "" && storePath != expectedStorePath)
|
||||
throw nix::Error("store path mismatch in file downloaded from '%s'", url);
|
||||
|
||||
return storePath;
|
||||
return store->toRealPath(storePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -73,6 +73,13 @@ std::map<std::string, std::string> getEnv()
|
||||
}
|
||||
|
||||
|
||||
void clearEnv()
|
||||
{
|
||||
for (auto & name : getEnv())
|
||||
unsetenv(name.first.c_str());
|
||||
}
|
||||
|
||||
|
||||
Path absPath(Path path, Path dir)
|
||||
{
|
||||
if (path[0] != '/') {
|
||||
|
||||
@@ -32,6 +32,9 @@ string getEnv(const string & key, const string & def = "");
|
||||
/* Get the entire environment. */
|
||||
std::map<std::string, std::string> getEnv();
|
||||
|
||||
/* Clear the environment. */
|
||||
void clearEnv();
|
||||
|
||||
/* Return an absolutized path, resolving paths relative to the
|
||||
specified directory, or the current directory otherwise. The path
|
||||
is also canonicalised. */
|
||||
|
||||
+1
-3
@@ -16,8 +16,6 @@ using namespace nix;
|
||||
|
||||
std::string chrootHelperName = "__run_in_chroot";
|
||||
|
||||
extern char * * environ;
|
||||
|
||||
struct CmdRun : InstallablesCommand
|
||||
{
|
||||
std::vector<std::string> command = { "bash" };
|
||||
@@ -109,7 +107,7 @@ struct CmdRun : InstallablesCommand
|
||||
if (s) kept[var] = s;
|
||||
}
|
||||
|
||||
environ = nullptr;
|
||||
clearEnv();
|
||||
|
||||
for (auto & var : kept)
|
||||
setenv(var.first.c_str(), var.second.c_str(), 1);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
true
|
||||
@@ -0,0 +1,16 @@
|
||||
assert include ./include-1.nix == 1;
|
||||
assert let x = 100; in include ./include-1.nix == 1;
|
||||
assert with { x = 123; }; include ./include-1.nix == 1;
|
||||
|
||||
assert let x = 2; in include ./include-2.nix == 3;
|
||||
assert let x = 3; in include ./include-2.nix == 4;
|
||||
assert let x = 3; in let x = 4; in include ./include-2.nix == 5;
|
||||
assert let x = 3; in let x = 4; in include ./include-2.nix == 5;
|
||||
assert let x = 6; in with { x = 7; }; include ./include-2.nix == 7;
|
||||
assert with { x = 0; }; let x = 6; in with { x = 7; }; include ./include-2.nix == 7;
|
||||
assert with { x = 0; }; let x = 6; in with { x = 7; }; let x = 7; in include ./include-2.nix == 8;
|
||||
assert with { x = 8; }; include ./include-2.nix == 9;
|
||||
|
||||
assert (let x = 10; in include ./include-3.nix) == 3628800;
|
||||
|
||||
true
|
||||
@@ -1 +1 @@
|
||||
[ "faabar" "fbar" "fubar" "faboor" "fubar" ]
|
||||
[ "faabar" "fbar" "fubar" "faboor" "fubar" "XaXbXcX" "X" "a_b" ]
|
||||
@@ -5,4 +5,7 @@ with builtins;
|
||||
(replaceStrings ["oo"] ["u"] "foobar")
|
||||
(replaceStrings ["oo" "a"] ["a" "oo"] "foobar")
|
||||
(replaceStrings ["oo" "oo"] ["u" "i"] "foobar")
|
||||
(replaceStrings [""] ["X"] "abc")
|
||||
(replaceStrings [""] ["X"] "")
|
||||
(replaceStrings ["-"] ["_"] "a-b")
|
||||
]
|
||||
@@ -0,0 +1 @@
|
||||
let x = 1; in x
|
||||
@@ -0,0 +1 @@
|
||||
1 + x
|
||||
@@ -0,0 +1 @@
|
||||
if x > 0 then x * (let x_ = x; in let x = x_ - 1; in include ./include-3.nix) else 1
|
||||
Reference in new issue
Block a user