From 0a5944572275dd042453303c964130e9e6aaa0a3 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Thu, 7 Aug 2025 16:59:45 +0200 Subject: [PATCH 1/4] ci/eval: fix min-free-swap report This was checking the wrong condition, likely from a copy&pasto. --- ci/eval/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/eval/default.nix b/ci/eval/default.nix index 21285757a277..9de67643e709 100644 --- a/ci/eval/default.nix +++ b/ci/eval/default.nix @@ -167,7 +167,7 @@ let if [[ ! -f "$out/${evalSystem}/min-avail-memory" ]] || (( availMemory < $(<$out/${evalSystem}/min-avail-memory) )); then echo "$availMemory" > $out/${evalSystem}/min-avail-memory fi - if [[ ! -f $out/${evalSystem}/min-free-swap ]] || (( availMemory < $(<$out/${evalSystem}/min-free-swap) )); then + if [[ ! -f $out/${evalSystem}/min-free-swap ]] || (( freeSwap < $(<$out/${evalSystem}/min-free-swap) )); then echo "$freeSwap" > $out/${evalSystem}/min-free-swap fi sleep 4 From cb527a04e03a1393d54d761ce95e06c47d724b5b Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Thu, 7 Aug 2025 17:13:51 +0200 Subject: [PATCH 2/4] ci/eval: return min memory in megabyte No need to return bytes in these files. Also busybox has problems to render `free -b` with sizes > 100 GB properly in the next commit, leading to extraction errors with awk. --- ci/eval/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ci/eval/default.nix b/ci/eval/default.nix index 9de67643e709..018a5b092526 100644 --- a/ci/eval/default.nix +++ b/ci/eval/default.nix @@ -160,9 +160,9 @@ let # Record and print stats on free memory and swap in the background ( while true; do - availMemory=$(free -b | grep Mem | awk '{print $7}') - freeSwap=$(free -b | grep Swap | awk '{print $4}') - echo "Available memory: $(( availMemory / 1024 / 1024 )) MiB, free swap: $(( freeSwap / 1024 / 1024 )) MiB" + availMemory=$(free -m | grep Mem | awk '{print $7}') + freeSwap=$(free -m | grep Swap | awk '{print $4}') + echo "Available memory: $(( availMemory )) MiB, free swap: $(( freeSwap )) MiB" if [[ ! -f "$out/${evalSystem}/min-avail-memory" ]] || (( availMemory < $(<$out/${evalSystem}/min-avail-memory) )); then echo "$availMemory" > $out/${evalSystem}/min-avail-memory From 5c697b8aea5b292be5f6abc1285cd975bbd8dd68 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Thu, 7 Aug 2025 16:38:14 +0200 Subject: [PATCH 3/4] ci/eval: reduce closure size `procps` pulls in 180 MB of systemd, but busybox also provides `kill`. `busybox` also ships `time`, so no need for that extra dependency. Using `nativeBuildInputs` pulls in all the -dev outputs of the listed packages - which we don't need. We only need to run these tools, thus map to their bin outputs. Brings down the closure size from 500+ MB to 193 MB for the Eval job. This probably saves ~10 seconds for the job. --- ci/eval/compare/default.nix | 3 ++- ci/eval/default.nix | 21 +++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/ci/eval/compare/default.nix b/ci/eval/compare/default.nix index 5807f8ef52f7..81eebcc9adb1 100644 --- a/ci/eval/compare/default.nix +++ b/ci/eval/compare/default.nix @@ -122,7 +122,8 @@ let in runCommand "compare" { - nativeBuildInputs = [ + # Don't depend on -dev outputs to reduce closure size for CI. + nativeBuildInputs = map lib.getBin [ jq (python3.withPackages ( ps: with ps; [ diff --git a/ci/eval/default.nix b/ci/eval/default.nix index 018a5b092526..9887afd5e107 100644 --- a/ci/eval/default.nix +++ b/ci/eval/default.nix @@ -14,10 +14,9 @@ runCommand, writeShellScript, symlinkJoin, - time, - procps, - nix, + busybox, jq, + nix, }: let @@ -48,9 +47,10 @@ let runCommand "attrpaths-superset.json" { src = nixpkgs; - nativeBuildInputs = [ + # Don't depend on -dev outputs to reduce closure size for CI. + nativeBuildInputs = map lib.getBin [ + busybox nix - time ]; } '' @@ -131,11 +131,11 @@ let in runCommand "nixpkgs-eval-${evalSystem}" { - nativeBuildInputs = [ - nix - time - procps + # Don't depend on -dev outputs to reduce closure size for CI. + nativeBuildInputs = map lib.getBin [ + busybox jq + nix ]; env = { inherit evalSystem chunkSize; @@ -206,7 +206,8 @@ let }: runCommand "combined-eval" { - nativeBuildInputs = [ + # Don't depend on -dev outputs to reduce closure size for CI. + nativeBuildInputs = map lib.getBin [ jq ]; } From 75f40a150c9d1aa9869cd5de817e25129a92f78b Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Thu, 7 Aug 2025 16:39:04 +0200 Subject: [PATCH 4/4] ci/eval: use sane defaults Using these defaults makes it possible to just run `nix-build ci -A eval.singleSystem` without passing additional arguments and get a sane result back. Especially helpful when testing or debugging. A `chunkSize` of 5000 is conservative to be able to run on systems with less memory as well. Run-time is not impacted by that, as recent benchmarks show. --- ci/eval/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/eval/default.nix b/ci/eval/default.nix index 9887afd5e107..2b7f59ae6b43 100644 --- a/ci/eval/default.nix +++ b/ci/eval/default.nix @@ -72,11 +72,11 @@ let # The system to evaluate. # Note that this is intentionally not called `system`, # because `--argstr system` would only be passed to the ci/default.nix file! - evalSystem, + evalSystem ? builtins.currentSystem, # The path to the `paths.json` file from `attrpathsSuperset` attrpathFile ? "${attrpathsSuperset { inherit evalSystem; }}/paths.json", # The number of attributes per chunk, see ./README.md for more info. - chunkSize, + chunkSize ? 5000, checkMeta ? true, # Don't try to eval packages marked as broken.