From 60346bcba7955db58936da20287ff2b23e34b6d5 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Tue, 28 Nov 2023 11:18:18 +1300 Subject: [PATCH] experiment: Add Github Actions job for nix-eval-jobs --- .github/workflows/nix-eval-jobs.yml | 19 ++++++++ outpaths.nix | 69 +++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 .github/workflows/nix-eval-jobs.yml create mode 100644 outpaths.nix diff --git a/.github/workflows/nix-eval-jobs.yml b/.github/workflows/nix-eval-jobs.yml new file mode 100644 index 000000000000000..9dc6c36aa6bc910 --- /dev/null +++ b/.github/workflows/nix-eval-jobs.yml @@ -0,0 +1,19 @@ +name: Evaluation checks + +on: + workflow_dispatch: + push: + branches: + - master + +permissions: + contents: read + +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v23 + - run: nix-build ./. -A nix-eval-jobs + - run: ./result/bin/nix-eval-jobs --workers 1 ./outpaths.nix --arg checkMeta true > outpaths.json diff --git a/outpaths.nix b/outpaths.nix new file mode 100644 index 000000000000000..66c7648a061d65a --- /dev/null +++ b/outpaths.nix @@ -0,0 +1,69 @@ +#!/usr/bin/env nix-shell +# When using as a callable script, passing `--argstr path some/path` overrides $PWD. +#!nix-shell -p nix -i "nix-env -qaP --no-name --out-path --arg checkMeta true --argstr path $PWD -f" +{ checkMeta +, path ? ./. +}: +let + lib = import (path + "/lib"); + hydraJobs = import (path + "/pkgs/top-level/release.nix") + # Compromise: accuracy vs. resources needed for evaluation. + { + supportedSystems = [ + "aarch64-linux" + "aarch64-darwin" + #"i686-linux" # !!! + "x86_64-linux" + "x86_64-darwin" + ]; + + nixpkgsArgs = { + config = { + allowAliases = false; + allowBroken = true; + allowUnfree = true; + allowInsecurePredicate = x: true; + checkMeta = checkMeta; + + handleEvalIssue = reason: errormsg: + let + fatalErrors = [ + "unknown-meta" + "broken-outputs" + ]; + in + if builtins.elem reason fatalErrors + then abort errormsg + else true; + + inHydra = true; + }; + }; + }; + recurseIntoAttrs = attrs: attrs // { recurseForDerivations = true; }; + + # hydraJobs leaves recurseForDerivations as empty attrmaps; + # that would break nix-env and we also need to recurse everywhere. + tweak = lib.mapAttrs + (name: val: + if name == "recurseForDerivations" then true + else if lib.isAttrs val && val.type or null != "derivation" + then recurseIntoAttrs (tweak val) + else val + ); + + # Some of these contain explicit references to platform(s) we want to avoid; + # some even (transitively) depend on ~/.nixpkgs/config.nix (!) + blacklist = [ + "tarball" + "metrics" + "manual" + "darwin-tested" + "unstable" + "stdenvBootstrapTools" + "moduleSystem" + "lib-tests" # these just confuse the output + ]; + +in +tweak (builtins.removeAttrs hydraJobs blacklist)