From 30f19cce69104f25418b92ef9ad023fa705714a0 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Fri, 18 Jul 2025 17:49:13 +0200 Subject: [PATCH] ci/eval: fail on asserts when generating attrpaths This doesn't fail on *all* asserts, yet, because nix-env still ignores these in the main eval step. But it already gives some converage during the attrpath generation. --- ci/eval/default.nix | 3 +-- pkgs/top-level/all-packages.nix | 8 +++----- pkgs/top-level/release-attrpaths-superset.nix | 18 ++++-------------- 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/ci/eval/default.nix b/ci/eval/default.nix index efe216c98f5c..31bc6b01c327 100644 --- a/ci/eval/default.nix +++ b/ci/eval/default.nix @@ -64,8 +64,7 @@ let -I "$src" \ --option restrict-eval true \ --option allow-import-from-derivation false \ - --option eval-system "${evalSystem}" \ - --arg enableWarnings false > $out/paths.json + --option eval-system "${evalSystem}" > $out/paths.json ''; singleSystem = diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index fcf38107ed8b..8b7cfa1aec93 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -113,12 +113,10 @@ with pkgs; stringsWithDeps = lib.stringsWithDeps; - ### Evaluating the entire Nixpkgs naively will fail, make failure fast + ### Evaluating the entire Nixpkgs naively will likely fail, make failure fast AAAAAASomeThingsFailToEvaluate = throw '' - Please be informed that this pseudo-package is not the only part - of Nixpkgs that fails to evaluate. You should not evaluate - entire Nixpkgs without some special measures to handle failing - packages, like using pkgs/top-level/release-attrpaths-superset.nix. + This pseudo-package is likely not the only part of Nixpkgs that fails to evaluate. + You should not evaluate entire Nixpkgs without measures to handle failing packages. ''; tests = callPackages ../test { }; diff --git a/pkgs/top-level/release-attrpaths-superset.nix b/pkgs/top-level/release-attrpaths-superset.nix index 6802da8b3711..894c795ff587 100644 --- a/pkgs/top-level/release-attrpaths-superset.nix +++ b/pkgs/top-level/release-attrpaths-superset.nix @@ -24,7 +24,6 @@ { lib ? import (path + "/lib"), trace ? false, - enableWarnings ? true, checkMeta ? true, path ? ./../.., }: @@ -62,8 +61,10 @@ let justAttrNames = path: value: let - attempt = - if + result = + if path == [ "AAAAAASomeThingsFailToEvaluate" ] then + [ ] + else if lib.isDerivation value && # in some places we have *derivations* with jobsets as subattributes, ugh @@ -94,17 +95,6 @@ let builtins.attrValues builtins.concatLists ]; - - seq = builtins.deepSeq attempt attempt; - tried = builtins.tryEval seq; - - result = - if tried.success then - tried.value - else if enableWarnings && path != [ "AAAAAASomeThingsFailToEvaluate" ] then - lib.warn "tryEval failed at: ${lib.concatStringsSep "." path}" [ ] - else - [ ]; in if !trace then result else lib.trace "** ${lib.concatStringsSep "." path}" result;