Skip to content

Commit

Permalink
experiment: Add Github Actions job for nix-eval-jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
adisbladis committed Nov 27, 2023
1 parent 5a09cb4 commit 60346bc
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/nix-eval-jobs.yml
Original file line number Diff line number Diff line change
@@ -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
69 changes: 69 additions & 0 deletions outpaths.nix
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 60346bc

Please sign in to comment.