5b4b4074e1052b27dbadbdaa05df17eef09b2cf2 — Aluísio Augusto Silva Gonçalves 5 months ago 5a695ec
ci.nix: Filter out packages incompatible with Nixpkgs system

It's the same filtering we use in flake.nix.  I'm not sure if filtering
on `meta.platforms` is needed, but that assert on the `linux` derivation
kills the whole job before it even starts.
1 files changed, 8 insertions(+), 3 deletions(-)

M ci.nix
M ci.nix => ci.nix +8 -3
@@ 1,16 1,21 @@
{ pkgs ? import <nixpkgs> { } }:
  inherit (pkgs) recurseIntoAttrs;
  inherit (pkgs.lib) deepSeq filterAttrs isDerivation mapAttrs pipe;
  inherit (pkgs) recurseIntoAttrs stdenv;
  inherit (pkgs.lib) deepSeq filterAttrs hasPrefix isDerivation mapAttrs pipe;

  selectDerivations = set:
      derivationTree = value:
        if isDerivation value
        # Output derivations directly, but only if they're compatible
        # with this platform.
        if isDerivation value && builtins.elem pkgs.system value.meta.platforms
        then value
        else if value ? recurseForDerivations && value.recurseForDerivations == true
          pipe value [
            # Don't evaluate linuxPackages outside Linux, or it will
            # break everything.
            (filterAttrs (name: value: ! stdenv.isLinux -> ! hasPrefix "linuxPackages" name))
            (mapAttrs (name: derivationTree))
            (filterAttrs (name: value: value != null))