1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 14:21:48 +02:00

Merge remote-tracking branch 'upstream/master' into lfs

This commit is contained in:
Leandro Reina 2025-01-27 14:44:41 +01:00
commit 6a3b4afc0a
347 changed files with 8407 additions and 5795 deletions

View file

@ -1,6 +1,25 @@
let
sixteenBytes = "0123456789abcdef";
times16 = s: builtins.concatStringsSep "" [s s s s s s s s s s s s s s s s];
times16 =
s:
builtins.concatStringsSep "" [
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
];
exp = n: x: if n == 1 then x else times16 (exp (n - 1) x);
sixteenMegabyte = exp 6 sixteenBytes;
in

View file

@ -4,24 +4,39 @@ with import ./config.nix;
let
mkDerivation = args:
derivation ({
inherit system;
builder = busybox;
args = ["sh" "-e" args.builder or (builtins.toFile "builder-${args.name}.sh" ''
if [ -e "$NIX_ATTRS_SH_FILE" ]; then source $NIX_ATTRS_SH_FILE; fi;
eval "$buildCommand"
'')];
outputHashMode = "recursive";
outputHashAlgo = "sha256";
} // removeAttrs args ["builder" "meta" "passthru"])
// { meta = args.meta or {}; passthru = args.passthru or {}; };
mkDerivation =
args:
derivation (
{
inherit system;
builder = busybox;
args = [
"sh"
"-e"
args.builder or (builtins.toFile "builder-${args.name}.sh" ''
if [ -e "$NIX_ATTRS_SH_FILE" ]; then source $NIX_ATTRS_SH_FILE; fi;
eval "$buildCommand"
'')
];
outputHashMode = "recursive";
outputHashAlgo = "sha256";
}
// removeAttrs args [
"builder"
"meta"
"passthru"
]
)
// {
meta = args.meta or { };
passthru = args.passthru or { };
};
input1 = mkDerivation {
shell = busybox;
name = "build-remote-input-1";
buildCommand = "echo hi-input1; echo FOO > $out";
requiredSystemFeatures = ["foo"];
requiredSystemFeatures = [ "foo" ];
outputHash = "sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc=";
};
@ -29,7 +44,7 @@ let
shell = busybox;
name = "build-remote-input-2";
buildCommand = "echo hi; echo BAR > $out";
requiredSystemFeatures = ["bar"];
requiredSystemFeatures = [ "bar" ];
outputHash = "sha256-XArauVH91AVwP9hBBQNlkX9ccuPpSYx9o0zeIHb6e+Q=";
};
@ -41,21 +56,20 @@ let
read x < ${input2}
echo $x BAZ > $out
'';
requiredSystemFeatures = ["baz"];
requiredSystemFeatures = [ "baz" ];
outputHash = "sha256-daKAcPp/+BYMQsVi/YYMlCKoNAxCNDsaivwSHgQqD2s=";
};
in
mkDerivation {
shell = busybox;
name = "build-remote";
passthru = { inherit input1 input2 input3; };
buildCommand =
''
read x < ${input1}
read y < ${input3}
echo "$x $y" > $out
'';
outputHash = "sha256-5SxbkUw6xe2l9TE1uwCvTtTDysD1vhRor38OtDF0LqQ=";
}
mkDerivation {
shell = busybox;
name = "build-remote";
passthru = { inherit input1 input2 input3; };
buildCommand = ''
read x < ${input1}
read y < ${input3}
echo "$x $y" > $out
'';
outputHash = "sha256-5SxbkUw6xe2l9TE1uwCvTtTDysD1vhRor38OtDF0LqQ=";
}

View file

@ -1,39 +1,61 @@
{ busybox, contentAddressed ? false }:
{
busybox,
contentAddressed ? false,
}:
with import ./config.nix;
let
caArgs = if contentAddressed then {
outputHashMode = "recursive";
outputHashAlgo = "sha256";
__contentAddressed = true;
} else {};
caArgs =
if contentAddressed then
{
outputHashMode = "recursive";
outputHashAlgo = "sha256";
__contentAddressed = true;
}
else
{ };
mkDerivation = args:
derivation ({
inherit system;
builder = busybox;
args = ["sh" "-e" args.builder or (builtins.toFile "builder-${args.name}.sh" ''
if [ -e "$NIX_ATTRS_SH_FILE" ]; then source $NIX_ATTRS_SH_FILE; fi;
eval "$buildCommand"
'')];
} // removeAttrs args ["builder" "meta" "passthru"]
// caArgs)
// { meta = args.meta or {}; passthru = args.passthru or {}; };
mkDerivation =
args:
derivation (
{
inherit system;
builder = busybox;
args = [
"sh"
"-e"
args.builder or (builtins.toFile "builder-${args.name}.sh" ''
if [ -e "$NIX_ATTRS_SH_FILE" ]; then source $NIX_ATTRS_SH_FILE; fi;
eval "$buildCommand"
'')
];
}
// removeAttrs args [
"builder"
"meta"
"passthru"
]
// caArgs
)
// {
meta = args.meta or { };
passthru = args.passthru or { };
};
input1 = mkDerivation {
shell = busybox;
name = "build-remote-input-1";
buildCommand = "echo hi-input1; echo FOO > $out";
requiredSystemFeatures = ["foo"];
requiredSystemFeatures = [ "foo" ];
};
input2 = mkDerivation {
shell = busybox;
name = "build-remote-input-2";
buildCommand = "echo hi; echo BAR > $out";
requiredSystemFeatures = ["bar"];
requiredSystemFeatures = [ "bar" ];
};
input3 = mkDerivation {
@ -44,19 +66,18 @@ let
read x < ${input2}
echo $x BAZ > $out
'';
requiredSystemFeatures = ["baz"];
requiredSystemFeatures = [ "baz" ];
};
in
mkDerivation {
shell = busybox;
name = "build-remote";
passthru = { inherit input1 input2 input3; };
buildCommand =
''
read x < ${input1}
read y < ${input3}
echo "$x $y" > $out
'';
}
mkDerivation {
shell = busybox;
name = "build-remote";
passthru = { inherit input1 input2 input3; };
buildCommand = ''
read x < ${input1}
read y < ${input3}
echo "$x $y" > $out
'';
}

View file

@ -1 +1,5 @@
{ inNixShell ? false, ... }@args: import ./shell.nix (args // { contentAddressed = true; })
{
inNixShell ? false,
...
}@args:
import ./shell.nix (args // { contentAddressed = true; })

View file

@ -1,13 +1,21 @@
with import ./config.nix;
let mkCADerivation = args: mkDerivation ({
__contentAddressed = true;
outputHashMode = "recursive";
outputHashAlgo = "sha256";
} // args);
let
mkCADerivation =
args:
mkDerivation (
{
__contentAddressed = true;
outputHashMode = "recursive";
outputHashAlgo = "sha256";
}
// args
);
in
{ seed ? 0 }:
{
seed ? 0,
}:
# A simple content-addressed derivation.
# The derivation can be arbitrarily modified by passing a different `seed`,
# but the output will always be the same
@ -23,7 +31,11 @@ rec {
};
rootCA = mkCADerivation {
name = "rootCA";
outputs = [ "out" "dev" "foo" ];
outputs = [
"out"
"dev"
"foo"
];
buildCommand = ''
echo "building a CA derivation"
echo "The seed is ${toString seed}"

View file

@ -1,3 +1,3 @@
{
outputs = { self }: import ./content-addressed.nix {};
outputs = { self }: import ./content-addressed.nix { };
}

View file

@ -1,10 +1,16 @@
with import ./config.nix;
let mkCADerivation = args: mkDerivation ({
__contentAddressed = true;
outputHashMode = "recursive";
outputHashAlgo = "sha256";
} // args);
let
mkCADerivation =
args:
mkDerivation (
{
__contentAddressed = true;
outputHashMode = "recursive";
outputHashAlgo = "sha256";
}
// args
);
in
rec {
@ -15,13 +21,15 @@ rec {
echo $(date) > $out/current-time
'';
};
dep = seed: mkCADerivation {
name = "dep";
inherit seed;
buildCommand = ''
echo ${currentTime} > $out
'';
};
dep =
seed:
mkCADerivation {
name = "dep";
inherit seed;
buildCommand = ''
echo ${currentTime} > $out
'';
};
dep1 = dep 1;
dep2 = dep 2;
toplevel = mkCADerivation {
@ -32,4 +40,3 @@ rec {
'';
};
}

View file

@ -1,7 +1,6 @@
# A derivation that would certainly fail if several builders tried to
# build it at once.
with import ./config.nix;
mkDerivation {

View file

@ -2,11 +2,16 @@ with import ./config.nix;
rec {
dep = import ./dependencies.nix {};
dep = import ./dependencies.nix { };
makeTest = nr: args: mkDerivation ({
name = "check-refs-" + toString nr;
} // args);
makeTest =
nr: args:
mkDerivation (
{
name = "check-refs-" + toString nr;
}
// args
);
src = builtins.toFile "aux-ref" "bla bla";
@ -22,31 +27,31 @@ rec {
test3 = makeTest 3 {
builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $dep $out/link";
allowedReferences = [];
allowedReferences = [ ];
inherit dep;
};
test4 = makeTest 4 {
builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $dep $out/link";
allowedReferences = [dep];
allowedReferences = [ dep ];
inherit dep;
};
test5 = makeTest 5 {
builder = builtins.toFile "builder.sh" "mkdir $out";
allowedReferences = [];
allowedReferences = [ ];
inherit dep;
};
test6 = makeTest 6 {
builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $out $out/link";
allowedReferences = [];
allowedReferences = [ ];
inherit dep;
};
test7 = makeTest 7 {
builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $out $out/link";
allowedReferences = ["out"];
allowedReferences = [ "out" ];
inherit dep;
};
@ -58,19 +63,19 @@ rec {
test9 = makeTest 9 {
builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $dep $out/link";
inherit dep;
disallowedReferences = [dep];
disallowedReferences = [ dep ];
};
test10 = makeTest 10 {
builder = builtins.toFile "builder.sh" "mkdir $out; echo $test5; ln -s $dep $out/link";
inherit dep test5;
disallowedReferences = [test5];
disallowedReferences = [ test5 ];
};
test11 = makeTest 11 {
__structuredAttrs = true;
unsafeDiscardReferences.out = true;
outputChecks.out.allowedReferences = [];
outputChecks.out.allowedReferences = [ ];
buildCommand = ''echo ${dep} > "''${outputs[out]}"'';
};

View file

@ -22,36 +22,48 @@ rec {
'';
};
makeTest = nr: allowreqs: mkDerivation {
name = "check-reqs-" + toString nr;
inherit deps;
builder = builtins.toFile "builder.sh" ''
mkdir $out
ln -s $deps $out/depdir1
'';
allowedRequisites = allowreqs;
};
makeTest =
nr: allowreqs:
mkDerivation {
name = "check-reqs-" + toString nr;
inherit deps;
builder = builtins.toFile "builder.sh" ''
mkdir $out
ln -s $deps $out/depdir1
'';
allowedRequisites = allowreqs;
};
# When specifying all the requisites, the build succeeds.
test1 = makeTest 1 [ dep1 dep2 deps ];
test1 = makeTest 1 [
dep1
dep2
deps
];
# But missing anything it fails.
test2 = makeTest 2 [ dep2 deps ];
test3 = makeTest 3 [ dep1 deps ];
test2 = makeTest 2 [
dep2
deps
];
test3 = makeTest 3 [
dep1
deps
];
test4 = makeTest 4 [ deps ];
test5 = makeTest 5 [];
test5 = makeTest 5 [ ];
test6 = mkDerivation {
name = "check-reqs";
inherit deps;
builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $deps $out/depdir1";
disallowedRequisites = [dep1];
disallowedRequisites = [ dep1 ];
};
test7 = mkDerivation {
name = "check-reqs";
inherit deps;
builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $deps $out/depdir1";
disallowedRequisites = [test1];
disallowedRequisites = [ test1 ];
};
}

View file

@ -1,4 +1,6 @@
{checkBuildId ? 0}:
{
checkBuildId ? 0,
}:
with import ./config.nix;
@ -6,41 +8,38 @@ with import ./config.nix;
nondeterministic = mkDerivation {
inherit checkBuildId;
name = "nondeterministic";
buildCommand =
''
mkdir $out
date +%s.%N > $out/date
echo "CHECK_TMPDIR=$TMPDIR"
echo "checkBuildId=$checkBuildId"
echo "$checkBuildId" > $TMPDIR/checkBuildId
'';
buildCommand = ''
mkdir $out
date +%s.%N > $out/date
echo "CHECK_TMPDIR=$TMPDIR"
echo "checkBuildId=$checkBuildId"
echo "$checkBuildId" > $TMPDIR/checkBuildId
'';
};
deterministic = mkDerivation {
inherit checkBuildId;
name = "deterministic";
buildCommand =
''
mkdir $out
echo date > $out/date
echo "CHECK_TMPDIR=$TMPDIR"
echo "checkBuildId=$checkBuildId"
echo "$checkBuildId" > $TMPDIR/checkBuildId
'';
buildCommand = ''
mkdir $out
echo date > $out/date
echo "CHECK_TMPDIR=$TMPDIR"
echo "checkBuildId=$checkBuildId"
echo "$checkBuildId" > $TMPDIR/checkBuildId
'';
};
failed = mkDerivation {
inherit checkBuildId;
name = "failed";
buildCommand =
''
mkdir $out
echo date > $out/date
echo "CHECK_TMPDIR=$TMPDIR"
echo "checkBuildId=$checkBuildId"
echo "$checkBuildId" > $TMPDIR/checkBuildId
false
'';
buildCommand = ''
mkdir $out
echo date > $out/date
echo "CHECK_TMPDIR=$TMPDIR"
echo "checkBuildId=$checkBuildId"
echo "$checkBuildId" > $TMPDIR/checkBuildId
false
'';
};
hashmismatch = import <nix/fetchurl.nix> {

View file

@ -60,6 +60,7 @@ unset XDG_DATA_HOME
unset XDG_CONFIG_HOME
unset XDG_CONFIG_DIRS
unset XDG_CACHE_HOME
unset GIT_DIR
export IMPURE_VAR1=foo
export IMPURE_VAR2=bar

View file

@ -1,4 +1,6 @@
{ hashInvalidator ? "" }:
{
hashInvalidator ? "",
}:
with import ./config.nix;
let

View file

@ -2,5 +2,8 @@ derivation {
name = "advanced-attributes-defaults";
system = "my-system";
builder = "/bin/bash";
args = [ "-c" "echo hello > $out" ];
args = [
"-c"
"echo hello > $out"
];
}

View file

@ -2,7 +2,13 @@ derivation {
name = "advanced-attributes-structured-attrs-defaults";
system = "my-system";
builder = "/bin/bash";
args = [ "-c" "echo hello > $out" ];
outputs = [ "out" "dev" ];
args = [
"-c"
"echo hello > $out"
];
outputs = [
"out"
"dev"
];
__structuredAttrs = true;
}

View file

@ -4,42 +4,58 @@ let
inherit system;
name = "foo";
builder = "/bin/bash";
args = ["-c" "echo foo > $out"];
args = [
"-c"
"echo foo > $out"
];
};
bar = derivation {
inherit system;
name = "bar";
builder = "/bin/bash";
args = ["-c" "echo bar > $out"];
args = [
"-c"
"echo bar > $out"
];
};
in
derivation {
inherit system;
name = "advanced-attributes-structured-attrs";
builder = "/bin/bash";
args = [ "-c" "echo hello > $out" ];
args = [
"-c"
"echo hello > $out"
];
__sandboxProfile = "sandcastle";
__noChroot = true;
__impureHostDeps = ["/usr/bin/ditto"];
impureEnvVars = ["UNICORN"];
__impureHostDeps = [ "/usr/bin/ditto" ];
impureEnvVars = [ "UNICORN" ];
__darwinAllowLocalNetworking = true;
outputs = [ "out" "bin" "dev" ];
outputs = [
"out"
"bin"
"dev"
];
__structuredAttrs = true;
outputChecks = {
out = {
allowedReferences = [foo];
allowedRequisites = [foo];
allowedReferences = [ foo ];
allowedRequisites = [ foo ];
};
bin = {
disallowedReferences = [bar];
disallowedRequisites = [bar];
disallowedReferences = [ bar ];
disallowedRequisites = [ bar ];
};
dev = {
maxSize = 789;
maxClosureSize = 5909;
};
};
requiredSystemFeatures = ["rainbow" "uid-range"];
requiredSystemFeatures = [
"rainbow"
"uid-range"
];
preferLocalBuild = true;
allowSubstitutes = false;
}

View file

@ -4,30 +4,42 @@ let
inherit system;
name = "foo";
builder = "/bin/bash";
args = ["-c" "echo foo > $out"];
args = [
"-c"
"echo foo > $out"
];
};
bar = derivation {
inherit system;
name = "bar";
builder = "/bin/bash";
args = ["-c" "echo bar > $out"];
args = [
"-c"
"echo bar > $out"
];
};
in
derivation {
inherit system;
name = "advanced-attributes";
builder = "/bin/bash";
args = [ "-c" "echo hello > $out" ];
args = [
"-c"
"echo hello > $out"
];
__sandboxProfile = "sandcastle";
__noChroot = true;
__impureHostDeps = ["/usr/bin/ditto"];
impureEnvVars = ["UNICORN"];
__impureHostDeps = [ "/usr/bin/ditto" ];
impureEnvVars = [ "UNICORN" ];
__darwinAllowLocalNetworking = true;
allowedReferences = [foo];
allowedRequisites = [foo];
disallowedReferences = [bar];
disallowedRequisites = [bar];
requiredSystemFeatures = ["rainbow" "uid-range"];
allowedReferences = [ foo ];
allowedRequisites = [ foo ];
disallowedReferences = [ bar ];
disallowedRequisites = [ bar ];
requiredSystemFeatures = [
"rainbow"
"uid-range"
];
preferLocalBuild = true;
allowSubstitutes = false;
}

View file

@ -1,6 +1,8 @@
with import ./config.nix;
let innerName = "foo"; in
let
innerName = "foo";
in
mkDerivation rec {
name = "${innerName}.drv";

View file

@ -2,28 +2,33 @@ with import ./config.nix;
rec {
printRefs =
''
echo $exportReferencesGraph
while read path; do
read drv
read nrRefs
echo "$path has $nrRefs references"
echo "$path" >> $out
for ((n = 0; n < $nrRefs; n++)); do read ref; echo "ref $ref"; test -e "$ref"; done
done < refs
'';
printRefs = ''
echo $exportReferencesGraph
while read path; do
read drv
read nrRefs
echo "$path has $nrRefs references"
echo "$path" >> $out
for ((n = 0; n < $nrRefs; n++)); do read ref; echo "ref $ref"; test -e "$ref"; done
done < refs
'';
foo."bar.runtimeGraph" = mkDerivation {
name = "dependencies";
builder = builtins.toFile "build-graph-builder" "${printRefs}";
exportReferencesGraph = ["refs" (import ./dependencies.nix {})];
exportReferencesGraph = [
"refs"
(import ./dependencies.nix { })
];
};
foo."bar.buildGraph" = mkDerivation {
name = "dependencies";
builder = builtins.toFile "build-graph-builder" "${printRefs}";
exportReferencesGraph = ["refs" (import ./dependencies.nix {}).drvPath];
exportReferencesGraph = [
"refs"
(import ./dependencies.nix { }).drvPath
];
};
}

View file

@ -2,16 +2,29 @@
with import ./config.nix;
let
mkDerivation = args:
derivation ({
inherit system;
builder = busybox;
args = ["sh" "-e" args.builder or (builtins.toFile "builder-${args.name}.sh" ''
if [ -e "$NIX_ATTRS_SH_FILE" ]; then source $NIX_ATTRS_SH_FILE; fi;
eval "$buildCommand"
'')];
} // removeAttrs args ["builder" "meta"])
// { meta = args.meta or {}; };
mkDerivation =
args:
derivation (
{
inherit system;
builder = busybox;
args = [
"sh"
"-e"
args.builder or (builtins.toFile "builder-${args.name}.sh" ''
if [ -e "$NIX_ATTRS_SH_FILE" ]; then source $NIX_ATTRS_SH_FILE; fi;
eval "$buildCommand"
'')
];
}
// removeAttrs args [
"builder"
"meta"
]
)
// {
meta = args.meta or { };
};
in
{

View file

@ -4,9 +4,12 @@ mkDerivation {
name = "filter";
builder = builtins.toFile "builder" "ln -s $input $out";
input =
let filter = path: type:
type != "symlink"
&& baseNameOf path != "foo"
&& !((import ./lang/lib.nix).hasSuffix ".bak" (baseNameOf path));
in builtins.filterSource filter ((builtins.getEnv "TEST_ROOT") + "/filterin");
let
filter =
path: type:
type != "symlink"
&& baseNameOf path != "foo"
&& !((import ./lang/lib.nix).hasSuffix ".bak" (baseNameOf path));
in
builtins.filterSource filter ((builtins.getEnv "TEST_ROOT") + "/filterin");
}

View file

@ -2,15 +2,20 @@ with import ./config.nix;
rec {
f2 = dummy: builder: mode: algo: hash: mkDerivation {
name = "fixed";
inherit builder;
outputHashMode = mode;
outputHashAlgo = algo;
outputHash = hash;
inherit dummy;
impureEnvVars = ["IMPURE_VAR1" "IMPURE_VAR2"];
};
f2 =
dummy: builder: mode: algo: hash:
mkDerivation {
name = "fixed";
inherit builder;
outputHashMode = mode;
outputHashAlgo = algo;
outputHash = hash;
inherit dummy;
impureEnvVars = [
"IMPURE_VAR1"
"IMPURE_VAR2"
];
};
f = f2 "";
@ -37,7 +42,8 @@ rec {
];
sameAsAdd =
f ./fixed.builder2.sh "recursive" "sha256" "1ixr6yd3297ciyp9im522dfxpqbkhcw0pylkb2aab915278fqaik";
f ./fixed.builder2.sh "recursive" "sha256"
"1ixr6yd3297ciyp9im522dfxpqbkhcw0pylkb2aab915278fqaik";
bad = [
(f ./fixed.builder1.sh "flat" "md5" "0ddd8be4b179a529afa5f2ffae4b9858")
@ -66,4 +72,7 @@ rec {
# Can use "nar" instead of "recursive" now.
nar-not-recursive = f2 "foo" ./fixed.builder2.sh "nar" "md5" "3670af73070fa14077ad74e0f5ea4e42";
# Experimental feature
git = f2 "foo" ./fixed.builder2.sh "git" "sha1" "cd44baf36915d5dec8374232ea7e2057f3b4494e";
}

View file

@ -2,38 +2,34 @@ with import ./config.nix;
rec {
x1 = mkDerivation {
name = "x1";
builder = builtins.toFile "builder.sh"
''
echo $name > $out
'';
builder = builtins.toFile "builder.sh" ''
echo $name > $out
'';
outputHashMode = "recursive";
outputHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
};
x2 = mkDerivation {
name = "x2";
builder = builtins.toFile "builder.sh"
''
echo $name > $out
'';
builder = builtins.toFile "builder.sh" ''
echo $name > $out
'';
outputHashMode = "recursive";
outputHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
};
x3 = mkDerivation {
name = "x3";
builder = builtins.toFile "builder.sh"
''
echo $name > $out
'';
builder = builtins.toFile "builder.sh" ''
echo $name > $out
'';
outputHashMode = "recursive";
outputHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
};
x4 = mkDerivation {
name = "x4";
inherit x2 x3;
builder = builtins.toFile "builder.sh"
''
echo $x2 $x3
exit 1
'';
builder = builtins.toFile "builder.sh" ''
echo $x2 $x3
exit 1
'';
};
}

View file

@ -1,6 +1,8 @@
with import ./config.nix;
{ lockFifo ? null }:
{
lockFifo ? null,
}:
rec {

View file

@ -0,0 +1,6 @@
source common.sh
# Store layer needs bugfix
requireDaemonNewerThan "2.27pre20250122"
nix-build ../fixed.nix -A git --no-out-link

View file

@ -3,6 +3,7 @@ suites += {
'deps': [],
'tests': [
'simple.sh',
'fixed.sh',
],
'workdir': meson.current_source_dir(),
}

View file

@ -4,14 +4,22 @@ let {
name = "dependencies-input-1";
system = "i086-msdos";
builder = "/bar/sh";
args = ["-e" "-x" ./dummy];
args = [
"-e"
"-x"
./dummy
];
};
input2 = derivation {
name = "dependencies-input-2";
system = "i086-msdos";
builder = "/bar/sh";
args = ["-e" "-x" ./dummy];
args = [
"-e"
"-x"
./dummy
];
outputHashMode = "recursive";
outputHashAlgo = "md5";
outputHash = "ffffffffffffffffffffffffffffffff";
@ -21,9 +29,13 @@ let {
name = "dependencies";
system = "i086-msdos";
builder = "/bar/sh";
args = ["-e" "-x" (./dummy + "/FOOBAR/../.")];
args = [
"-e"
"-x"
(./dummy + "/FOOBAR/../.")
];
input1 = input1 + "/.";
inherit input2;
};
}
}

View file

@ -2,6 +2,31 @@
source common.sh
function subcommands() {
jq -r '
def recurse($prefix):
to_entries[] |
($prefix + [.key]) as $newPrefix |
(if .value | has("commands") then
($newPrefix, (.value.commands | recurse($newPrefix)))
else
$newPrefix
end);
.args.commands | recurse([]) | join(" ")
'
}
nix __dump-cli | subcommands | while IFS= read -r cmd; do
# shellcheck disable=SC2086 # word splitting of cmd is intended
nix $cmd --help
done
[[ $(type -p man) ]] || skipTest "'man' not installed"
# FIXME: we don't know whether we built the manpages, so we can't
# reliably test them here.
exit 0
# test help output
nix-build --help
@ -49,22 +74,3 @@ nix-daemon --help
nix-hash --help
nix-instantiate --help
nix-prefetch-url --help
function subcommands() {
jq -r '
def recurse($prefix):
to_entries[] |
($prefix + [.key]) as $newPrefix |
(if .value | has("commands") then
($newPrefix, (.value.commands | recurse($newPrefix)))
else
$newPrefix
end);
.args.commands | recurse([]) | join(" ")
'
}
nix __dump-cli | subcommands | while IFS= read -r cmd; do
# shellcheck disable=SC2086 # word splitting of cmd is intended
nix $cmd --help
done

View file

@ -1,31 +1,51 @@
{ busybox
, seed
# If we want the final derivation output to have references to its
# dependencies. Some tests need/want this, other don't.
, withFinalRefs ? false
{
busybox,
seed,
# If we want the final derivation output to have references to its
# dependencies. Some tests need/want this, other don't.
withFinalRefs ? false,
}:
with import ./config.nix;
let
contentAddressedByDefault = builtins.getEnv "NIX_TESTS_CA_BY_DEFAULT" == "1";
caArgs = if contentAddressedByDefault then {
__contentAddressed = true;
outputHashMode = "recursive";
outputHashAlgo = "sha256";
} else {};
caArgs =
if contentAddressedByDefault then
{
__contentAddressed = true;
outputHashMode = "recursive";
outputHashAlgo = "sha256";
}
else
{ };
mkDerivation = args:
derivation ({
inherit system;
builder = busybox;
args = ["sh" "-e" args.builder or (builtins.toFile "builder-${args.name}.sh" ''
if [ -e "$NIX_ATTRS_SH_FILE" ]; then source $NIX_ATTRS_SH_FILE; fi;
eval "$buildCommand"
'')];
} // removeAttrs args ["builder" "meta" "passthru"]
// caArgs)
// { meta = args.meta or {}; passthru = args.passthru or {}; };
mkDerivation =
args:
derivation (
{
inherit system;
builder = busybox;
args = [
"sh"
"-e"
args.builder or (builtins.toFile "builder-${args.name}.sh" ''
if [ -e "$NIX_ATTRS_SH_FILE" ]; then source $NIX_ATTRS_SH_FILE; fi;
eval "$buildCommand"
'')
];
}
// removeAttrs args [
"builder"
"meta"
"passthru"
]
// caArgs
)
// {
meta = args.meta or { };
passthru = args.passthru or { };
};
input1 = mkDerivation {
shell = busybox;
@ -51,14 +71,15 @@ let
in
mkDerivation {
shell = busybox;
name = "hermetic";
passthru = { inherit input1 input2 input3; };
buildCommand =
''
read x < ${input1}
read y < ${input3}
echo ${if (builtins.trace withFinalRefs withFinalRefs) then "${input1} ${input3}" else ""} "$x $y" > $out
'';
}
mkDerivation {
shell = busybox;
name = "hermetic";
passthru = { inherit input1 input2 input3; };
buildCommand = ''
read x < ${input1}
read y < ${input3}
echo ${
if (builtins.trace withFinalRefs withFinalRefs) then "${input1} ${input3}" else ""
} "$x $y" > $out
'';
}

View file

@ -1,10 +1,8 @@
with import ./config.nix;
import (
mkDerivation {
name = "foo";
bla = import ./dependencies.nix {};
buildCommand = "
import (mkDerivation {
name = "foo";
bla = import ./dependencies.nix { };
buildCommand = "
echo \\\"hi\\\" > $out
";
}
)
})

View file

@ -3,10 +3,9 @@ with import <config>;
rec {
bar = mkDerivation {
name = "bar";
builder = builtins.toFile "builder.sh"
''
echo 'builtins.add 123 456' > $out
'';
builder = builtins.toFile "builder.sh" ''
echo 'builtins.add 123 456' > $out
'';
};
value =
@ -16,19 +15,17 @@ rec {
result = mkDerivation {
name = "foo";
builder = builtins.toFile "builder.sh"
''
echo -n FOO${toString value} > $out
'';
builder = builtins.toFile "builder.sh" ''
echo -n FOO${toString value} > $out
'';
};
addPath = mkDerivation {
name = "add-path";
src = builtins.filterSource (path: type: true) result;
builder = builtins.toFile "builder.sh"
''
echo -n BLA$(cat $src) > $out
'';
builder = builtins.toFile "builder.sh" ''
echo -n BLA$(cat $src) > $out
'';
};
step1 = mkDerivation {

View file

@ -4,60 +4,58 @@ rec {
impure = mkDerivation {
name = "impure";
outputs = [ "out" "stuff" ];
buildCommand =
''
echo impure
x=$(< $TEST_ROOT/counter)
mkdir $out $stuff
echo $x > $out/n
ln -s $out/n $stuff/bla
printf $((x + 1)) > $TEST_ROOT/counter
'';
outputs = [
"out"
"stuff"
];
buildCommand = ''
echo impure
x=$(< $TEST_ROOT/counter)
mkdir $out $stuff
echo $x > $out/n
ln -s $out/n $stuff/bla
printf $((x + 1)) > $TEST_ROOT/counter
'';
__impure = true;
impureEnvVars = [ "TEST_ROOT" ];
};
impureOnImpure = mkDerivation {
name = "impure-on-impure";
buildCommand =
''
echo impure-on-impure
x=$(< ${impure}/n)
mkdir $out
printf X$x > $out/n
ln -s ${impure.stuff} $out/symlink
ln -s $out $out/self
'';
buildCommand = ''
echo impure-on-impure
x=$(< ${impure}/n)
mkdir $out
printf X$x > $out/n
ln -s ${impure.stuff} $out/symlink
ln -s $out $out/self
'';
__impure = true;
};
# This is not allowed.
inputAddressed = mkDerivation {
name = "input-addressed";
buildCommand =
''
cat ${impure} > $out
'';
buildCommand = ''
cat ${impure} > $out
'';
};
contentAddressed = mkDerivation {
name = "content-addressed";
buildCommand =
''
echo content-addressed
x=$(< ${impureOnImpure}/n)
printf ''${x:0:1} > $out
'';
buildCommand = ''
echo content-addressed
x=$(< ${impureOnImpure}/n)
printf ''${x:0:1} > $out
'';
outputHashMode = "recursive";
outputHash = "sha256-eBYxcgkuWuiqs4cKNgKwkb3vY/HR0vVsJnqe8itJGcQ=";
};
inputAddressedAfterCA = mkDerivation {
name = "input-addressed-after-ca";
buildCommand =
''
cat ${contentAddressed} > $out
'';
buildCommand = ''
cat ${contentAddressed} > $out
'';
};
}

View file

@ -1,4 +1,3 @@
# Run:
# GC_INITIAL_HEAP_SIZE=$[1024 * 1024] NIX_SHOW_STATS=1 nix eval -f gc-coroutine-test.nix -vvvv
@ -11,55 +10,56 @@ let
# Generate a tree of numbers, n deep, such that the numbers add up to (1 + salt) * 10^n.
# The salting makes the numbers all different, increasing the likelihood of catching
# any memory corruptions that might be caused by the GC or otherwise.
garbage = salt: n:
if n == 0
then [(1 + salt)]
else [
(garbage (10 * salt + 1) (n - 1))
(garbage (10 * salt - 1) (n - 1))
(garbage (10 * salt + 2) (n - 1))
(garbage (10 * salt - 2) (n - 1))
(garbage (10 * salt + 3) (n - 1))
(garbage (10 * salt - 3) (n - 1))
(garbage (10 * salt + 4) (n - 1))
(garbage (10 * salt - 4) (n - 1))
(garbage (10 * salt + 5) (n - 1))
(garbage (10 * salt - 5) (n - 1))
];
garbage =
salt: n:
if n == 0 then
[ (1 + salt) ]
else
[
(garbage (10 * salt + 1) (n - 1))
(garbage (10 * salt - 1) (n - 1))
(garbage (10 * salt + 2) (n - 1))
(garbage (10 * salt - 2) (n - 1))
(garbage (10 * salt + 3) (n - 1))
(garbage (10 * salt - 3) (n - 1))
(garbage (10 * salt + 4) (n - 1))
(garbage (10 * salt - 4) (n - 1))
(garbage (10 * salt + 5) (n - 1))
(garbage (10 * salt - 5) (n - 1))
];
pow = base: n:
if n == 0
then 1
else base * (pow base (n - 1));
pow = base: n: if n == 0 then 1 else base * (pow base (n - 1));
sumNestedLists = l:
if isList l
then foldl' (a: b: a + sumNestedLists b) 0 l
else l;
sumNestedLists = l: if isList l then foldl' (a: b: a + sumNestedLists b) 0 l else l;
in
assert sumNestedLists (garbage 0 3) == pow 10 3;
assert sumNestedLists (garbage 0 6) == pow 10 6;
builtins.foldl'
(a: b:
assert
"${
builtins.path {
path = ./src;
filter = path: type:
# We're not doing common subexpression elimination, so this reallocates
# the fairly big tree over and over, producing a lot of garbage during
# source filtering, whose filter runs in a coroutine.
assert sumNestedLists (garbage 0 3) == pow 10 3;
true;
}
}"
== "${./src}";
assert sumNestedLists (garbage 0 3) == pow 10 3;
assert sumNestedLists (garbage 0 6) == pow 10 6;
builtins.foldl'
(
a: b:
assert
"${builtins.path {
path = ./src;
filter =
path: type:
# We're not doing common subexpression elimination, so this reallocates
# the fairly big tree over and over, producing a lot of garbage during
# source filtering, whose filter runs in a coroutine.
assert sumNestedLists (garbage 0 3) == pow 10 3;
true;
}}" == "${./src}";
# These asserts don't seem necessary, as the lambda value get corrupted first
assert a.okay;
assert b.okay;
{ okay = true; }
)
# These asserts don't seem necessary, as the lambda value get corrupted first
assert a.okay;
assert b.okay;
{
okay = true;
}
)
{ okay = true; }
[
{ okay = true; }
[ { okay = true; } { okay = true; } { okay = true; } ]
{ okay = true; }
{ okay = true; }
]

View file

@ -1,9 +1,9 @@
error:
… while calling the 'addDrvOutputDependencies' builtin
at /pwd/lang/eval-fail-addDrvOutputDependencies-multi-elem-context.nix:18:4:
17|
18| in builtins.addDrvOutputDependencies combo-path
| ^
19|
at /pwd/lang/eval-fail-addDrvOutputDependencies-multi-elem-context.nix:25:1:
24| in
25| builtins.addDrvOutputDependencies combo-path
| ^
26|
error: context of string '/nix/store/pg9yqs4yd85yhdm3f4i5dyaqp5jahrsz-fail.drv/nix/store/2dxd5frb715z451vbf7s8birlf3argbk-fail-2.drv' must have exactly one element, but has 2

View file

@ -3,16 +3,23 @@ let
name = "fail";
builder = "/bin/false";
system = "x86_64-linux";
outputs = [ "out" "foo" ];
outputs = [
"out"
"foo"
];
};
drv1 = derivation {
name = "fail-2";
builder = "/bin/false";
system = "x86_64-linux";
outputs = [ "out" "foo" ];
outputs = [
"out"
"foo"
];
};
combo-path = "${drv0.drvPath}${drv1.drvPath}";
in builtins.addDrvOutputDependencies combo-path
in
builtins.addDrvOutputDependencies combo-path

View file

@ -1,9 +1,9 @@
error:
… while calling the 'addDrvOutputDependencies' builtin
at /pwd/lang/eval-fail-addDrvOutputDependencies-wrong-element-kind.nix:9:4:
8|
9| in builtins.addDrvOutputDependencies drv.outPath
| ^
10|
at /pwd/lang/eval-fail-addDrvOutputDependencies-wrong-element-kind.nix:13:1:
12| in
13| builtins.addDrvOutputDependencies drv.outPath
| ^
14|
error: `addDrvOutputDependencies` can only act on derivations, not on a derivation output such as 'out'

View file

@ -3,7 +3,11 @@ let
name = "fail";
builder = "/bin/false";
system = "x86_64-linux";
outputs = [ "out" "foo" ];
outputs = [
"out"
"foo"
];
};
in builtins.addDrvOutputDependencies drv.outPath
in
builtins.addDrvOutputDependencies drv.outPath

View file

@ -1,9 +1,9 @@
let
countDown = n:
if n == 0
then throw "kaboom"
countDown =
n:
if n == 0 then
throw "kaboom"
else
builtins.addErrorContext
"while counting down; n = ${toString n}"
("x" + countDown (n - 1));
in countDown 10
builtins.addErrorContext "while counting down; n = ${toString n}" ("x" + countDown (n - 1));
in
countDown 10

View file

@ -1,8 +1,8 @@
error:
… while evaluating the condition of the assertion '({ a = true; } == { a = true; b = true; })'
at /pwd/lang/eval-fail-assert-equal-attrs-names-2.nix:1:1:
1| assert { a = true; } == { a = true; b = true; };
1| assert
| ^
2| throw "unreachable"
2| {
error: attribute names of attribute set '{ a = true; }' differs from attribute set '{ a = true; b = true; }'

View file

@ -1,2 +1,8 @@
assert { a = true; } == { a = true; b = true; };
assert
{
a = true;
} == {
a = true;
b = true;
};
throw "unreachable"

View file

@ -1,8 +1,8 @@
error:
… while evaluating the condition of the assertion '({ a = true; b = true; } == { a = true; })'
at /pwd/lang/eval-fail-assert-equal-attrs-names.nix:1:1:
1| assert { a = true; b = true; } == { a = true; };
1| assert
| ^
2| throw "unreachable"
2| {
error: attribute names of attribute set '{ a = true; b = true; }' differs from attribute set '{ a = true; }'

View file

@ -1,2 +1,8 @@
assert { a = true; b = true; } == { a = true; };
assert
{
a = true;
b = true;
} == {
a = true;
};
throw "unreachable"

View file

@ -3,23 +3,23 @@ error:
at /pwd/lang/eval-fail-assert-equal-derivations-extra.nix:1:1:
1| assert
| ^
2| { foo = { type = "derivation"; outPath = "/nix/store/0"; }; }
2| {
… while comparing attribute 'foo'
… where left hand side is
at /pwd/lang/eval-fail-assert-equal-derivations-extra.nix:2:5:
1| assert
2| { foo = { type = "derivation"; outPath = "/nix/store/0"; }; }
at /pwd/lang/eval-fail-assert-equal-derivations-extra.nix:3:5:
2| {
3| foo = {
| ^
3| ==
4| type = "derivation";
… where right hand side is
at /pwd/lang/eval-fail-assert-equal-derivations-extra.nix:4:5:
3| ==
4| { foo = { type = "derivation"; outPath = "/nix/store/1"; devious = true; }; };
at /pwd/lang/eval-fail-assert-equal-derivations-extra.nix:8:5:
7| } == {
8| foo = {
| ^
5| throw "unreachable"
9| type = "derivation";
… while comparing a derivation by its 'outPath' attribute

View file

@ -1,5 +1,14 @@
assert
{ foo = { type = "derivation"; outPath = "/nix/store/0"; }; }
==
{ foo = { type = "derivation"; outPath = "/nix/store/1"; devious = true; }; };
throw "unreachable"
{
foo = {
type = "derivation";
outPath = "/nix/store/0";
};
} == {
foo = {
type = "derivation";
outPath = "/nix/store/1";
devious = true;
};
};
throw "unreachable"

View file

@ -3,23 +3,23 @@ error:
at /pwd/lang/eval-fail-assert-equal-derivations.nix:1:1:
1| assert
| ^
2| { foo = { type = "derivation"; outPath = "/nix/store/0"; ignored = abort "not ignored"; }; }
2| {
… while comparing attribute 'foo'
… where left hand side is
at /pwd/lang/eval-fail-assert-equal-derivations.nix:2:5:
1| assert
2| { foo = { type = "derivation"; outPath = "/nix/store/0"; ignored = abort "not ignored"; }; }
at /pwd/lang/eval-fail-assert-equal-derivations.nix:3:5:
2| {
3| foo = {
| ^
3| ==
4| type = "derivation";
… where right hand side is
at /pwd/lang/eval-fail-assert-equal-derivations.nix:4:5:
3| ==
4| { foo = { type = "derivation"; outPath = "/nix/store/1"; ignored = abort "not ignored"; }; };
at /pwd/lang/eval-fail-assert-equal-derivations.nix:9:5:
8| } == {
9| foo = {
| ^
5| throw "unreachable"
10| type = "derivation";
… while comparing a derivation by its 'outPath' attribute

View file

@ -1,5 +1,15 @@
assert
{ foo = { type = "derivation"; outPath = "/nix/store/0"; ignored = abort "not ignored"; }; }
==
{ foo = { type = "derivation"; outPath = "/nix/store/1"; ignored = abort "not ignored"; }; };
throw "unreachable"
{
foo = {
type = "derivation";
outPath = "/nix/store/0";
ignored = abort "not ignored";
};
} == {
foo = {
type = "derivation";
outPath = "/nix/store/1";
ignored = abort "not ignored";
};
};
throw "unreachable"

View file

@ -2,8 +2,8 @@ error:
… while evaluating the condition of the assertion '((x: x) == (x: x))'
at /pwd/lang/eval-fail-assert-equal-function-direct.nix:3:1:
2| # This only compares a direct comparison and makes no claims about functions in nested structures.
3| assert
3| assert (x: x) == (x: x);
| ^
4| (x: x)
4| abort "unreachable"
error: distinct functions and immediate comparisons of identical functions compare as unequal

View file

@ -1,7 +1,4 @@
# Note: functions in nested structures, e.g. attributes, may be optimized away by pointer identity optimization.
# This only compares a direct comparison and makes no claims about functions in nested structures.
assert
(x: x)
==
(x: x);
abort "unreachable"
assert (x: x) == (x: x);
abort "unreachable"

View file

@ -1,8 +1,8 @@
error:
… while evaluating the condition of the assertion '([ (1) (0) ] == [ (10) ])'
at /pwd/lang/eval-fail-assert-equal-list-length.nix:1:1:
1| assert [ 1 0 ] == [ 10 ];
1| assert
| ^
2| throw "unreachable"
2| [
error: list of size '2' is not equal to list of size '1', left hand side is '[ 1 0 ]', right hand side is '[ 10 ]'

View file

@ -1,2 +1,6 @@
assert [ 1 0 ] == [ 10 ];
throw "unreachable"
assert
[
1
0
] == [ 10 ];
throw "unreachable"

View file

@ -1,2 +1,2 @@
assert ./foo == ./bar;
throw "unreachable"
throw "unreachable"

View file

@ -1,74 +1,66 @@
error:
… while evaluating the condition of the assertion '({ a = { b = [ ({ c = { d = true; }; }) ]; }; } == { a = { b = [ ({ c = { d = false; }; }) ]; }; })'
at /pwd/lang/eval-fail-assert-nested-bool.nix:1:1:
1| assert
1| assert { a.b = [ { c.d = true; } ]; } == { a.b = [ { c.d = false; } ]; };
| ^
2| { a.b = [ { c.d = true; } ]; }
2|
… while comparing attribute 'a'
… where left hand side is
at /pwd/lang/eval-fail-assert-nested-bool.nix:2:5:
1| assert
2| { a.b = [ { c.d = true; } ]; }
| ^
3| ==
at /pwd/lang/eval-fail-assert-nested-bool.nix:1:10:
1| assert { a.b = [ { c.d = true; } ]; } == { a.b = [ { c.d = false; } ]; };
| ^
2|
… where right hand side is
at /pwd/lang/eval-fail-assert-nested-bool.nix:4:5:
3| ==
4| { a.b = [ { c.d = false; } ]; };
| ^
5|
at /pwd/lang/eval-fail-assert-nested-bool.nix:1:44:
1| assert { a.b = [ { c.d = true; } ]; } == { a.b = [ { c.d = false; } ]; };
| ^
2|
… while comparing attribute 'b'
… where left hand side is
at /pwd/lang/eval-fail-assert-nested-bool.nix:2:5:
1| assert
2| { a.b = [ { c.d = true; } ]; }
| ^
3| ==
at /pwd/lang/eval-fail-assert-nested-bool.nix:1:10:
1| assert { a.b = [ { c.d = true; } ]; } == { a.b = [ { c.d = false; } ]; };
| ^
2|
… where right hand side is
at /pwd/lang/eval-fail-assert-nested-bool.nix:4:5:
3| ==
4| { a.b = [ { c.d = false; } ]; };
| ^
5|
at /pwd/lang/eval-fail-assert-nested-bool.nix:1:44:
1| assert { a.b = [ { c.d = true; } ]; } == { a.b = [ { c.d = false; } ]; };
| ^
2|
… while comparing list element 0
… while comparing attribute 'c'
… where left hand side is
at /pwd/lang/eval-fail-assert-nested-bool.nix:2:15:
1| assert
2| { a.b = [ { c.d = true; } ]; }
| ^
3| ==
at /pwd/lang/eval-fail-assert-nested-bool.nix:1:20:
1| assert { a.b = [ { c.d = true; } ]; } == { a.b = [ { c.d = false; } ]; };
| ^
2|
… where right hand side is
at /pwd/lang/eval-fail-assert-nested-bool.nix:4:15:
3| ==
4| { a.b = [ { c.d = false; } ]; };
| ^
5|
at /pwd/lang/eval-fail-assert-nested-bool.nix:1:54:
1| assert { a.b = [ { c.d = true; } ]; } == { a.b = [ { c.d = false; } ]; };
| ^
2|
… while comparing attribute 'd'
… where left hand side is
at /pwd/lang/eval-fail-assert-nested-bool.nix:2:15:
1| assert
2| { a.b = [ { c.d = true; } ]; }
| ^
3| ==
at /pwd/lang/eval-fail-assert-nested-bool.nix:1:20:
1| assert { a.b = [ { c.d = true; } ]; } == { a.b = [ { c.d = false; } ]; };
| ^
2|
… where right hand side is
at /pwd/lang/eval-fail-assert-nested-bool.nix:4:15:
3| ==
4| { a.b = [ { c.d = false; } ]; };
| ^
5|
at /pwd/lang/eval-fail-assert-nested-bool.nix:1:54:
1| assert { a.b = [ { c.d = true; } ]; } == { a.b = [ { c.d = false; } ]; };
| ^
2|
error: boolean 'true' is not equal to boolean 'false'

View file

@ -1,6 +1,3 @@
assert
{ a.b = [ { c.d = true; } ]; }
==
{ a.b = [ { c.d = false; } ]; };
assert { a.b = [ { c.d = true; } ]; } == { a.b = [ { c.d = false; } ]; };
abort "unreachable"
abort "unreachable"

View file

@ -1,30 +1,30 @@
error:
… while evaluating the attribute 'body'
at /pwd/lang/eval-fail-assert.nix:4:3:
3|
4| body = x "x";
at /pwd/lang/eval-fail-assert.nix:7:3:
6|
7| body = x "x";
| ^
5| }
8| }
… from call site
at /pwd/lang/eval-fail-assert.nix:4:10:
3|
4| body = x "x";
at /pwd/lang/eval-fail-assert.nix:7:10:
6|
7| body = x "x";
| ^
5| }
8| }
… while calling 'x'
at /pwd/lang/eval-fail-assert.nix:2:7:
1| let {
2| x = arg: assert arg == "y"; 123;
| ^
3|
at /pwd/lang/eval-fail-assert.nix:3:5:
2| x =
3| arg:
| ^
4| assert arg == "y";
… while evaluating the condition of the assertion '(arg == "y")'
at /pwd/lang/eval-fail-assert.nix:2:12:
1| let {
2| x = arg: assert arg == "y"; 123;
| ^
3|
at /pwd/lang/eval-fail-assert.nix:4:5:
3| arg:
4| assert arg == "y";
| ^
5| 123;
error: string '"x"' is not equal to string '"y"'

View file

@ -1,5 +1,8 @@
let {
x = arg: assert arg == "y"; 123;
x =
arg:
assert arg == "y";
123;
body = x "x";
}
}

View file

@ -2,20 +2,20 @@ error:
… while evaluating the attribute 'puppy."${key}"'
at /pwd/lang/eval-fail-attr-name-type.nix:3:5:
2| attrs = {
3| puppy.doggy = {};
3| puppy.doggy = { };
| ^
4| };
… while evaluating an attribute name
at /pwd/lang/eval-fail-attr-name-type.nix:7:17:
at /pwd/lang/eval-fail-attr-name-type.nix:7:15:
6| in
7| attrs.puppy.${key}
| ^
7| attrs.puppy.${key}
| ^
8|
error: expected a string but found an integer: 1
at /pwd/lang/eval-fail-attr-name-type.nix:7:17:
at /pwd/lang/eval-fail-attr-name-type.nix:7:15:
6| in
7| attrs.puppy.${key}
| ^
7| attrs.puppy.${key}
| ^
8|

View file

@ -1,7 +1,7 @@
let
attrs = {
puppy.doggy = {};
puppy.doggy = { };
};
key = 1;
in
attrs.puppy.${key}
attrs.puppy.${key}

View file

@ -1,5 +1,6 @@
error: undefined variable 'd'
at /pwd/lang/eval-fail-attrset-merge-drops-later-rec.nix:1:26:
1| { a.b = 1; a = rec { c = d + 2; d = 3; }; }.c
| ^
2|
at /pwd/lang/eval-fail-attrset-merge-drops-later-rec.nix:4:9:
3| a = rec {
4| c = d + 2;
| ^
5| d = 3;

View file

@ -1 +1,8 @@
{ a.b = 1; a = rec { c = d + 2; d = 3; }; }.c
{
a.b = 1;
a = rec {
c = d + 2;
d = 3;
};
}
.c

View file

@ -1,9 +1,9 @@
error:
… while evaluating a path segment
at /pwd/lang/eval-fail-bad-string-interpolation-4.nix:9:3:
8| # The error message should not be too long.
9| ''${pkgs}''
at /pwd/lang/eval-fail-bad-string-interpolation-4.nix:19:3:
18| # The error message should not be too long.
19| ''${pkgs}''
| ^
10|
20|
error: cannot coerce a set to a string: { a = { a = { a = { a = "ha"; b = "ha"; c = "ha"; d = "ha"; e = "ha"; f = "ha"; g = "ha"; h = "ha"; j = "ha"; }; «8 attributes elided» }; «8 attributes elided» }; «8 attributes elided» }

View file

@ -1,6 +1,16 @@
let
# Basically a "billion laughs" attack, but toned down to simulated `pkgs`.
ha = x: y: { a = x y; b = x y; c = x y; d = x y; e = x y; f = x y; g = x y; h = x y; j = x y; };
ha = x: y: {
a = x y;
b = x y;
c = x y;
d = x y;
e = x y;
f = x y;
g = x y;
h = x y;
j = x y;
};
has = ha (ha (ha (ha (x: x)))) "ha";
# A large structure that has already been evaluated.
pkgs = builtins.deepSeq has has;

View file

@ -1,17 +1,17 @@
error:
… while evaluating the attribute 'outPath'
at <nix/derivation-internal.nix>:<number>:<number>:
<number>| value = commonAttrs // {
<number>| outPath = builtins.getAttr outputName strict;
| ^
<number>| drvPath = strict.drvPath;
<number>| value = commonAttrs // {
<number>| outPath = builtins.getAttr outputName strict;
| ^
<number>| drvPath = strict.drvPath;
… while calling the 'getAttr' builtin
at <nix/derivation-internal.nix>:<number>:<number>:
<number>| value = commonAttrs // {
<number>| outPath = builtins.getAttr outputName strict;
| ^
<number>| drvPath = strict.drvPath;
<number>| value = commonAttrs // {
<number>| outPath = builtins.getAttr outputName strict;
| ^
<number>| drvPath = strict.drvPath;
… while calling the 'derivationStrict' builtin
at <nix/derivation-internal.nix>:<number>:<number>:

View file

@ -2,13 +2,13 @@ error:
… while evaluating the attribute 'set'
at /pwd/lang/eval-fail-dup-dynamic-attrs.nix:2:3:
1| {
2| set = { "${"" + "b"}" = 1; };
2| set = {
| ^
3| set = { "${"b" + ""}" = 2; };
3| "${"" + "b"}" = 1;
error: dynamic attribute 'b' already defined at /pwd/lang/eval-fail-dup-dynamic-attrs.nix:2:11
at /pwd/lang/eval-fail-dup-dynamic-attrs.nix:3:11:
2| set = { "${"" + "b"}" = 1; };
3| set = { "${"b" + ""}" = 2; };
| ^
4| }
error: dynamic attribute 'b' already defined at /pwd/lang/eval-fail-dup-dynamic-attrs.nix:3:5
at /pwd/lang/eval-fail-dup-dynamic-attrs.nix:6:5:
5| set = {
6| "${"b" + ""}" = 2;
| ^
7| };

View file

@ -1,4 +1,8 @@
{
set = { "${"" + "b"}" = 1; };
set = { "${"b" + ""}" = 2; };
set = {
"${"" + "b"}" = 1;
};
set = {
"${"b" + ""}" = 2;
};
}

View file

@ -1,51 +1,51 @@
error:
… from call site
at /pwd/lang/eval-fail-duplicate-traces.nix:9:3:
8| in
9| throwAfter 2
| ^
10|
at /pwd/lang/eval-fail-duplicate-traces.nix:6:1:
5| in
6| throwAfter 2
| ^
7|
… while calling 'throwAfter'
at /pwd/lang/eval-fail-duplicate-traces.nix:4:16:
3| let
4| throwAfter = n:
4| throwAfter = n: if n > 0 then throwAfter (n - 1) else throw "Uh oh!";
| ^
5| if n > 0
5| in
… from call site
at /pwd/lang/eval-fail-duplicate-traces.nix:6:10:
5| if n > 0
6| then throwAfter (n - 1)
| ^
7| else throw "Uh oh!";
at /pwd/lang/eval-fail-duplicate-traces.nix:4:33:
3| let
4| throwAfter = n: if n > 0 then throwAfter (n - 1) else throw "Uh oh!";
| ^
5| in
… while calling 'throwAfter'
at /pwd/lang/eval-fail-duplicate-traces.nix:4:16:
3| let
4| throwAfter = n:
4| throwAfter = n: if n > 0 then throwAfter (n - 1) else throw "Uh oh!";
| ^
5| if n > 0
5| in
… from call site
at /pwd/lang/eval-fail-duplicate-traces.nix:6:10:
5| if n > 0
6| then throwAfter (n - 1)
| ^
7| else throw "Uh oh!";
at /pwd/lang/eval-fail-duplicate-traces.nix:4:33:
3| let
4| throwAfter = n: if n > 0 then throwAfter (n - 1) else throw "Uh oh!";
| ^
5| in
… while calling 'throwAfter'
at /pwd/lang/eval-fail-duplicate-traces.nix:4:16:
3| let
4| throwAfter = n:
4| throwAfter = n: if n > 0 then throwAfter (n - 1) else throw "Uh oh!";
| ^
5| if n > 0
5| in
… while calling the 'throw' builtin
at /pwd/lang/eval-fail-duplicate-traces.nix:7:10:
6| then throwAfter (n - 1)
7| else throw "Uh oh!";
| ^
8| in
at /pwd/lang/eval-fail-duplicate-traces.nix:4:57:
3| let
4| throwAfter = n: if n > 0 then throwAfter (n - 1) else throw "Uh oh!";
| ^
5| in
error: Uh oh!

View file

@ -1,9 +1,6 @@
# Check that we only omit duplicate stack traces when there's a bunch of them.
# Here, there's only a couple duplicate entries, so we output them all.
let
throwAfter = n:
if n > 0
then throwAfter (n - 1)
else throw "Uh oh!";
throwAfter = n: if n > 0 then throwAfter (n - 1) else throw "Uh oh!";
in
throwAfter 2
throwAfter 2

View file

@ -1,8 +1,8 @@
error:
… while calling the 'fetchurl' builtin
at /pwd/lang/eval-fail-fetchurl-baseName-attrs-name.nix:1:1:
1| builtins.fetchurl { url = "https://example.com/foo.tar.gz"; name = "~wobble~"; }
1| builtins.fetchurl {
| ^
2|
2| url = "https://example.com/foo.tar.gz";
error: invalid store path name when fetching URL 'https://example.com/foo.tar.gz': name '~wobble~' contains illegal character '~'. Please change the value for the 'name' attribute passed to 'fetchurl', so that it can create a valid store path.

View file

@ -1 +1,4 @@
builtins.fetchurl { url = "https://example.com/foo.tar.gz"; name = "~wobble~"; }
builtins.fetchurl {
url = "https://example.com/foo.tar.gz";
name = "~wobble~";
}

View file

@ -1,14 +1,16 @@
error:
… while calling the 'seq' builtin
at /pwd/lang/eval-fail-flake-ref-to-string-negative-integer.nix:1:16:
1| let n = -1; in builtins.seq n (builtins.flakeRefToString {
| ^
2| type = "github";
at /pwd/lang/eval-fail-flake-ref-to-string-negative-integer.nix:4:1:
3| in
4| builtins.seq n (
| ^
5| builtins.flakeRefToString {
… while calling the 'flakeRefToString' builtin
at /pwd/lang/eval-fail-flake-ref-to-string-negative-integer.nix:1:32:
1| let n = -1; in builtins.seq n (builtins.flakeRefToString {
| ^
2| type = "github";
at /pwd/lang/eval-fail-flake-ref-to-string-negative-integer.nix:5:3:
4| builtins.seq n (
5| builtins.flakeRefToString {
| ^
6| type = "github";
error: negative value given for flake ref attr repo: -1

View file

@ -1,7 +1,12 @@
let n = -1; in builtins.seq n (builtins.flakeRefToString {
type = "github";
owner = "NixOS";
repo = n;
ref = "23.05";
dir = "lib";
})
let
n = -1;
in
builtins.seq n (
builtins.flakeRefToString {
type = "github";
owner = "NixOS";
repo = n;
ref = "23.05";
dir = "lib";
}
)

View file

@ -2,36 +2,36 @@ error:
… while calling the 'foldl'' builtin
at /pwd/lang/eval-fail-foldlStrict-strict-op-application.nix:2:1:
1| # Tests that the result of applying op is forced even if the value is never used
2| builtins.foldl'
2| builtins.foldl' (_: f: f null) null [
| ^
3| (_: f: f null)
3| (_: throw "Not the final value, but is still forced!")
… while calling anonymous lambda
at /pwd/lang/eval-fail-foldlStrict-strict-op-application.nix:3:7:
2| builtins.foldl'
3| (_: f: f null)
| ^
4| null
at /pwd/lang/eval-fail-foldlStrict-strict-op-application.nix:2:21:
1| # Tests that the result of applying op is forced even if the value is never used
2| builtins.foldl' (_: f: f null) null [
| ^
3| (_: throw "Not the final value, but is still forced!")
… from call site
at /pwd/lang/eval-fail-foldlStrict-strict-op-application.nix:3:10:
2| builtins.foldl'
3| (_: f: f null)
| ^
4| null
at /pwd/lang/eval-fail-foldlStrict-strict-op-application.nix:2:24:
1| # Tests that the result of applying op is forced even if the value is never used
2| builtins.foldl' (_: f: f null) null [
| ^
3| (_: throw "Not the final value, but is still forced!")
… while calling anonymous lambda
at /pwd/lang/eval-fail-foldlStrict-strict-op-application.nix:5:6:
4| null
5| [ (_: throw "Not the final value, but is still forced!") (_: 23) ]
| ^
6|
at /pwd/lang/eval-fail-foldlStrict-strict-op-application.nix:3:4:
2| builtins.foldl' (_: f: f null) null [
3| (_: throw "Not the final value, but is still forced!")
| ^
4| (_: 23)
… while calling the 'throw' builtin
at /pwd/lang/eval-fail-foldlStrict-strict-op-application.nix:5:9:
4| null
5| [ (_: throw "Not the final value, but is still forced!") (_: 23) ]
| ^
6|
at /pwd/lang/eval-fail-foldlStrict-strict-op-application.nix:3:7:
2| builtins.foldl' (_: f: f null) null [
3| (_: throw "Not the final value, but is still forced!")
| ^
4| (_: 23)
error: Not the final value, but is still forced!

View file

@ -1,5 +1,5 @@
# Tests that the result of applying op is forced even if the value is never used
builtins.foldl'
(_: f: f null)
null
[ (_: throw "Not the final value, but is still forced!") (_: 23) ]
builtins.foldl' (_: f: f null) null [
(_: throw "Not the final value, but is still forced!")
(_: 23)
]

View file

@ -1,10 +1,10 @@
error:
… while calling the 'toString' builtin
at /pwd/lang/eval-fail-hashfile-missing.nix:4:3:
3| in
4| toString (builtins.concatLists (map (hash: map (builtins.hashFile hash) paths) ["md5" "sha1" "sha256" "sha512"]))
| ^
5|
at /pwd/lang/eval-fail-hashfile-missing.nix:7:1:
6| in
7| toString (
| ^
8| builtins.concatLists (
… while evaluating the first argument passed to builtins.toString

View file

@ -1,5 +1,16 @@
let
paths = [ ./this-file-is-definitely-not-there-7392097 "/and/neither/is/this/37293620" ];
paths = [
./this-file-is-definitely-not-there-7392097
"/and/neither/is/this/37293620"
];
in
toString (builtins.concatLists (map (hash: map (builtins.hashFile hash) paths) ["md5" "sha1" "sha256" "sha512"]))
toString (
builtins.concatLists (
map (hash: map (builtins.hashFile hash) paths) [
"md5"
"sha1"
"sha256"
"sha512"
]
)
)

View file

@ -1,8 +1,8 @@
error:
… while evaluating one of the elements to concatenate
at /pwd/lang/eval-fail-list.nix:1:2:
1| 8++1
| ^
at /pwd/lang/eval-fail-list.nix:1:3:
1| 8 ++ 1
| ^
2|
error: expected a list but found an integer: 8

View file

@ -1 +1 @@
8++1
8 ++ 1

View file

@ -1,12 +1,13 @@
error:
… from call site
at /pwd/lang/eval-fail-missing-arg.nix:1:1:
1| ({x, y, z}: x + y + z) {x = "foo"; z = "bar";}
1| (
| ^
2|
2| {
error: function 'anonymous lambda' called without required argument 'y'
at /pwd/lang/eval-fail-missing-arg.nix:1:2:
1| ({x, y, z}: x + y + z) {x = "foo"; z = "bar";}
| ^
2|
at /pwd/lang/eval-fail-missing-arg.nix:2:3:
1| (
2| {
| ^
3| x,

View file

@ -1 +1,12 @@
({x, y, z}: x + y + z) {x = "foo"; z = "bar";}
(
{
x,
y,
z,
}:
x + y + z
)
{
x = "foo";
z = "bar";
}

View file

@ -1,64 +1,64 @@
error:
… from call site
at /pwd/lang/eval-fail-mutual-recursion.nix:36:3:
35| in
36| throwAfterA true 10
| ^
37|
at /pwd/lang/eval-fail-mutual-recursion.nix:40:1:
39| in
40| throwAfterA true 10
| ^
41|
… while calling 'throwAfterA'
at /pwd/lang/eval-fail-mutual-recursion.nix:29:26:
28|
29| throwAfterA = recurse: n:
| ^
30| if n > 0
at /pwd/lang/eval-fail-mutual-recursion.nix:32:14:
31| throwAfterA =
32| recurse: n:
| ^
33| if n > 0 then
… from call site
at /pwd/lang/eval-fail-mutual-recursion.nix:31:10:
30| if n > 0
31| then throwAfterA recurse (n - 1)
| ^
32| else if recurse
at /pwd/lang/eval-fail-mutual-recursion.nix:34:7:
33| if n > 0 then
34| throwAfterA recurse (n - 1)
| ^
35| else if recurse then
(19 duplicate frames omitted)
… from call site
at /pwd/lang/eval-fail-mutual-recursion.nix:33:10:
32| else if recurse
33| then throwAfterB true 10
| ^
34| else throw "Uh oh!";
at /pwd/lang/eval-fail-mutual-recursion.nix:36:7:
35| else if recurse then
36| throwAfterB true 10
| ^
37| else
… while calling 'throwAfterB'
at /pwd/lang/eval-fail-mutual-recursion.nix:22:26:
21| let
22| throwAfterB = recurse: n:
| ^
23| if n > 0
at /pwd/lang/eval-fail-mutual-recursion.nix:23:14:
22| throwAfterB =
23| recurse: n:
| ^
24| if n > 0 then
… from call site
at /pwd/lang/eval-fail-mutual-recursion.nix:24:10:
23| if n > 0
24| then throwAfterB recurse (n - 1)
| ^
25| else if recurse
at /pwd/lang/eval-fail-mutual-recursion.nix:25:7:
24| if n > 0 then
25| throwAfterB recurse (n - 1)
| ^
26| else if recurse then
(19 duplicate frames omitted)
… from call site
at /pwd/lang/eval-fail-mutual-recursion.nix:26:10:
25| else if recurse
26| then throwAfterA false 10
| ^
27| else throw "Uh oh!";
at /pwd/lang/eval-fail-mutual-recursion.nix:27:7:
26| else if recurse then
27| throwAfterA false 10
| ^
28| else
(21 duplicate frames omitted)
… while calling the 'throw' builtin
at /pwd/lang/eval-fail-mutual-recursion.nix:34:10:
33| then throwAfterB true 10
34| else throw "Uh oh!";
| ^
35| in
at /pwd/lang/eval-fail-mutual-recursion.nix:38:7:
37| else
38| throw "Uh oh!";
| ^
39| in
error: Uh oh!

View file

@ -19,18 +19,22 @@
# - a few frames of A (skip the rest)
# - a few frames of B (skip the rest, _and_ skip the remaining frames of A)
let
throwAfterB = recurse: n:
if n > 0
then throwAfterB recurse (n - 1)
else if recurse
then throwAfterA false 10
else throw "Uh oh!";
throwAfterB =
recurse: n:
if n > 0 then
throwAfterB recurse (n - 1)
else if recurse then
throwAfterA false 10
else
throw "Uh oh!";
throwAfterA = recurse: n:
if n > 0
then throwAfterA recurse (n - 1)
else if recurse
then throwAfterB true 10
else throw "Uh oh!";
throwAfterA =
recurse: n:
if n > 0 then
throwAfterA recurse (n - 1)
else if recurse then
throwAfterB true 10
else
throw "Uh oh!";
in
throwAfterA true 10
throwAfterA true 10

View file

@ -1,9 +1,9 @@
error:
… while evaluating a path segment
at /pwd/lang/eval-fail-nested-list-items.nix:11:6:
10|
11| "" + (let v = [ [ 1 2 3 4 5 6 7 8 ] [1 2 3 4]]; in builtins.deepSeq v v)
| ^
12|
at /pwd/lang/eval-fail-nested-list-items.nix:12:3:
11| ""
12| + (
| ^
13| let
error: cannot coerce a list to a string: [ [ 1 2 3 4 5 6 7 8 ] [ 1 «3 items elided» ] ]

View file

@ -8,4 +8,27 @@
#
# error: cannot coerce a list to a string: [ [ 1 2 3 4 5 6 7 8 ] [ 1 «4294967290 items elided» ] ]
"" + (let v = [ [ 1 2 3 4 5 6 7 8 ] [1 2 3 4]]; in builtins.deepSeq v v)
""
+ (
let
v = [
[
1
2
3
4
5
6
7
8
]
[
1
2
3
4
]
];
in
builtins.deepSeq v v
)

View file

@ -1,14 +1,14 @@
error:
… in the argument of the not operator
at /pwd/lang/eval-fail-not-throws.nix:1:4:
1| ! (throw "uh oh!")
| ^
at /pwd/lang/eval-fail-not-throws.nix:1:3:
1| !(throw "uh oh!")
| ^
2|
… while calling the 'throw' builtin
at /pwd/lang/eval-fail-not-throws.nix:1:4:
1| ! (throw "uh oh!")
| ^
at /pwd/lang/eval-fail-not-throws.nix:1:3:
1| !(throw "uh oh!")
| ^
2|
error: uh oh!

View file

@ -1 +1 @@
! (throw "uh oh!")
!(throw "uh oh!")

View file

@ -1,6 +1,6 @@
error: integer overflow in adding 9223372036854775807 + 1
at /pwd/lang/eval-fail-overflowing-add.nix:4:8:
3| b = 1;
4| in a + b
| ^
5|
at /pwd/lang/eval-fail-overflowing-add.nix:5:5:
4| in
5| a + b
| ^
6|

View file

@ -1,4 +1,5 @@
let
a = 9223372036854775807;
b = 1;
in a + b
in
a + b

View file

@ -1,23 +1,23 @@
error:
… while calling the 'seq' builtin
at /pwd/lang/eval-fail-overflowing-div.nix:7:4:
6| b = -1;
7| in builtins.seq intMin (builtins.seq b (intMin / b))
| ^
8|
at /pwd/lang/eval-fail-overflowing-div.nix:8:1:
7| in
8| builtins.seq intMin (builtins.seq b (intMin / b))
| ^
9|
… while calling the 'seq' builtin
at /pwd/lang/eval-fail-overflowing-div.nix:7:25:
6| b = -1;
7| in builtins.seq intMin (builtins.seq b (intMin / b))
| ^
8|
at /pwd/lang/eval-fail-overflowing-div.nix:8:22:
7| in
8| builtins.seq intMin (builtins.seq b (intMin / b))
| ^
9|
… while calling the 'div' builtin
at /pwd/lang/eval-fail-overflowing-div.nix:7:48:
6| b = -1;
7| in builtins.seq intMin (builtins.seq b (intMin / b))
| ^
8|
at /pwd/lang/eval-fail-overflowing-div.nix:8:45:
7| in
8| builtins.seq intMin (builtins.seq b (intMin / b))
| ^
9|
error: integer overflow in dividing -9223372036854775808 / -1

View file

@ -4,4 +4,5 @@ let
# of range
intMin = -9223372036854775807 - 1;
b = -1;
in builtins.seq intMin (builtins.seq b (intMin / b))
in
builtins.seq intMin (builtins.seq b (intMin / b))

View file

@ -1,16 +1,16 @@
error:
… while calling the 'mul' builtin
at /pwd/lang/eval-fail-overflowing-mul.nix:3:10:
2| a = 4294967297;
3| in a * a * a
| ^
4|
at /pwd/lang/eval-fail-overflowing-mul.nix:4:7:
3| in
4| a * a * a
| ^
5|
… while calling the 'mul' builtin
at /pwd/lang/eval-fail-overflowing-mul.nix:3:6:
2| a = 4294967297;
3| in a * a * a
| ^
4|
at /pwd/lang/eval-fail-overflowing-mul.nix:4:3:
3| in
4| a * a * a
| ^
5|
error: integer overflow in multiplying 4294967297 * 4294967297

View file

@ -1,3 +1,4 @@
let
a = 4294967297;
in a * a * a
in
a * a * a

View file

@ -1,9 +1,9 @@
error:
… while calling the 'sub' builtin
at /pwd/lang/eval-fail-overflowing-sub.nix:4:6:
3| b = 2;
4| in a - b
| ^
5|
at /pwd/lang/eval-fail-overflowing-sub.nix:5:3:
4| in
5| a - b
| ^
6|
error: integer overflow in subtracting -9223372036854775807 - 2

View file

@ -1,4 +1,5 @@
let
a = -9223372036854775807;
b = 2;
in a - b
in
a - b

View file

@ -1,12 +1,14 @@
error:
… in the right operand of the update (//) operator
at /pwd/lang/eval-fail-recursion.nix:1:12:
1| let a = {} // a; in a.foo
| ^
2|
at /pwd/lang/eval-fail-recursion.nix:2:11:
1| let
2| a = { } // a;
| ^
3| in
error: infinite recursion encountered
at /pwd/lang/eval-fail-recursion.nix:1:15:
1| let a = {} // a; in a.foo
| ^
2|
at /pwd/lang/eval-fail-recursion.nix:2:14:
1| let
2| a = { } // a;
| ^
3| in

View file

@ -1 +1,4 @@
let a = {} // a; in a.foo
let
a = { } // a;
in
a.foo

View file

@ -1,15 +1,15 @@
error:
… while evaluating the attribute 'body'
at /pwd/lang/eval-fail-remove.nix:4:3:
3|
4| body = (removeAttrs attrs ["x"]).x;
at /pwd/lang/eval-fail-remove.nix:7:3:
6|
7| body = (removeAttrs attrs [ "x" ]).x;
| ^
5| }
8| }
error: attribute 'x' missing
at /pwd/lang/eval-fail-remove.nix:4:10:
3|
4| body = (removeAttrs attrs ["x"]).x;
at /pwd/lang/eval-fail-remove.nix:7:10:
6|
7| body = (removeAttrs attrs [ "x" ]).x;
| ^
5| }
8| }
Did you mean y?

View file

@ -1,5 +1,8 @@
let {
attrs = {x = 123; y = 456;};
attrs = {
x = 123;
y = 456;
};
body = (removeAttrs attrs ["x"]).x;
}
body = (removeAttrs attrs [ "x" ]).x;
}

View file

@ -1,28 +1,28 @@
error:
… while evaluating the attribute 'body'
at /pwd/lang/eval-fail-scope-5.nix:8:3:
7|
8| body = f {};
at /pwd/lang/eval-fail-scope-5.nix:13:3:
12|
13| body = f { };
| ^
9|
14|
… from call site
at /pwd/lang/eval-fail-scope-5.nix:8:10:
7|
8| body = f {};
at /pwd/lang/eval-fail-scope-5.nix:13:10:
12|
13| body = f { };
| ^
9|
14|
… while calling 'f'
at /pwd/lang/eval-fail-scope-5.nix:6:7:
5|
6| f = {x ? y, y ? x}: x + y;
| ^
7|
at /pwd/lang/eval-fail-scope-5.nix:7:5:
6| f =
7| {
| ^
8| x ? y,
error: infinite recursion encountered
at /pwd/lang/eval-fail-scope-5.nix:6:12:
5|
6| f = {x ? y, y ? x}: x + y;
| ^
7|
at /pwd/lang/eval-fail-scope-5.nix:8:11:
7| {
8| x ? y,
| ^
9| y ? x,

View file

@ -3,8 +3,13 @@ let {
x = "a";
y = "b";
f = {x ? y, y ? x}: x + y;
f =
{
x ? y,
y ? x,
}:
x + y;
body = f {};
body = f { };
}

View file

@ -1,13 +1,13 @@
error:
… from call site
at /pwd/lang/eval-fail-undeclared-arg.nix:1:1:
1| ({x, z}: x + z) {x = "foo"; y = "bla"; z = "bar";}
1| ({ x, z }: x + z) {
| ^
2|
2| x = "foo";
error: function 'anonymous lambda' called with unexpected argument 'y'
at /pwd/lang/eval-fail-undeclared-arg.nix:1:2:
1| ({x, z}: x + z) {x = "foo"; y = "bla"; z = "bar";}
1| ({ x, z }: x + z) {
| ^
2|
2| x = "foo";
Did you mean one of x or z?

View file

@ -1 +1,5 @@
({x, z}: x + z) {x = "foo"; y = "bla"; z = "bar";}
({ x, z }: x + z) {
x = "foo";
y = "bla";
z = "bar";
}

Some files were not shown because too many files have changed in this diff Show more