1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-18 08:19:35 +01:00

Merge pull request #100 from DeterminateSystems/lib-tests-lazy

Run nixpkgsLibTests in lazy trees mode
This commit is contained in:
Eelco Dolstra 2025-06-11 18:51:13 +00:00 committed by GitHub
commit 168184a0d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 5 deletions

View file

@ -187,6 +187,19 @@ in
pkgs = nixpkgsFor.${system}.native;
}
);
nixpkgsLibTestsLazy = forAllSystems (
system:
lib.overrideDerivation
(import (nixpkgs + "/lib/tests/test-with-nix.nix") {
lib = nixpkgsFor.${system}.native.lib;
nix = self.packages.${system}.nix-cli;
pkgs = nixpkgsFor.${system}.native;
})
(_: {
"NIX_CONFIG" = "lazy-trees = true";
})
);
};
metrics.nixpkgs = import "${nixpkgs-regression}/pkgs/top-level/metrics.nix" {

View file

@ -17,6 +17,7 @@
#include <map>
#include <iostream>
#include <nlohmann/json.hpp>
using namespace nix;
@ -58,12 +59,16 @@ void processExpr(EvalState & state, const Strings & attrPaths,
context);
// We intentionally don't output a newline here. The default PS1 for Bash in NixOS starts with a newline
// and other interactive shells like Zsh are smart enough to print a missing newline before the prompt.
else if (output == okXML)
printValueAsXML(state, strict, location, vRes, std::cout, context, noPos);
else if (output == okXML) {
std::ostringstream s;
printValueAsXML(state, strict, location, vRes, s, context, noPos);
std::cout << state.devirtualize(s.str(), context);
}
else if (output == okJSON) {
printValueAsJSON(state, strict, vRes, v.determinePos(noPos), std::cout, context);
std::cout << std::endl;
} else {
auto j = printValueAsJSON(state, strict, vRes, v.determinePos(noPos), context);
std::cout << state.devirtualize(j.dump(), context) << std::endl;
}
else {
if (strict) state.forceValueDeep(vRes);
std::set<const void *> seen;
printAmbiguous(state, vRes, std::cout, &seen, std::numeric_limits<int>::max());