summary refs log tree commit diff
path: root/lib/fileset
diff options
context:
space:
mode:
authorSilvan Mosberger <silvan.mosberger@tweag.io>2023-09-20 21:08:13 +0200
committerSilvan Mosberger <silvan.mosberger@tweag.io>2023-10-03 21:27:40 +0200
commitb3c2281219893ee422e18f9d3917e8cc8216114d (patch)
treefdee05538db03c9ccbff93a53686424c9e68120f /lib/fileset
parente61356b9863f71e7b965f9b8ac3820e7d71af1a0 (diff)
downloadnixpkgs-b3c2281219893ee422e18f9d3917e8cc8216114d.tar
nixpkgs-b3c2281219893ee422e18f9d3917e8cc8216114d.tar.gz
nixpkgs-b3c2281219893ee422e18f9d3917e8cc8216114d.tar.bz2
nixpkgs-b3c2281219893ee422e18f9d3917e8cc8216114d.tar.lz
nixpkgs-b3c2281219893ee422e18f9d3917e8cc8216114d.tar.xz
nixpkgs-b3c2281219893ee422e18f9d3917e8cc8216114d.tar.zst
nixpkgs-b3c2281219893ee422e18f9d3917e8cc8216114d.zip
lib.fileset: Order noEval last
Diffstat (limited to 'lib/fileset')
-rw-r--r--lib/fileset/internal.nix12
-rwxr-xr-xlib/fileset/tests.sh4
2 files changed, 10 insertions, 6 deletions
diff --git a/lib/fileset/internal.nix b/lib/fileset/internal.nix
index b3dbc5b33dc..43e6dd31b71 100644
--- a/lib/fileset/internal.nix
+++ b/lib/fileset/internal.nix
@@ -114,8 +114,10 @@ rec {
     # The one and only!
     _internalIsEmptyWithoutBase = true;
 
-    # Double __ to make it be evaluated and ordered first
-    __noEval = throw _noEvalMessage;
+    # Due to alphabetical ordering, this is evaluated last,
+    # which makes the nix repl output nicer than if it would be ordered first.
+    # It also allows evaluating it strictly up to this error, which could be useful
+    _noEval = throw _noEvalMessage;
   };
 
   # Create a fileset, see ./README.md#fileset
@@ -137,8 +139,10 @@ rec {
       _internalBaseComponents = components parts.subpath;
       _internalTree = tree;
 
-      # Double __ to make it be evaluated and ordered first
-      __noEval = throw _noEvalMessage;
+      # Due to alphabetical ordering, this is evaluated last,
+      # which makes the nix repl output nicer than if it would be ordered first.
+      # It also allows evaluating it strictly up to this error, which could be useful
+      _noEval = throw _noEvalMessage;
     };
 
   # Coerce a value to a fileset, erroring when the value cannot be coerced.
diff --git a/lib/fileset/tests.sh b/lib/fileset/tests.sh
index 525b8aaa917..1b53e33073e 100755
--- a/lib/fileset/tests.sh
+++ b/lib/fileset/tests.sh
@@ -84,14 +84,14 @@ expectStorePath() {
     crudeUnquoteJSON <<< "$result"
 }
 
-# Check that a nix expression fails to evaluate (strictly, coercing to json, read-write-mode).
+# Check that a nix expression fails to evaluate (strictly, read-write-mode).
 # And check the received stderr against a regex
 # The expression has `lib.fileset` in scope.
 # Usage: expectFailure NIX REGEX
 expectFailure() {
     local expr=$1
     local expectedErrorRegex=$2
-    if result=$(nix-instantiate --eval --strict --json --read-write-mode --show-trace 2>"$tmp/stderr" \
+    if result=$(nix-instantiate --eval --strict --read-write-mode --show-trace 2>"$tmp/stderr" \
         --expr "$prefixExpression $expr"); then
         die "$expr evaluated successfully to $result, but it was expected to fail"
     fi