-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci.nix
38 lines (34 loc) · 1.33 KB
/
ci.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{ pkgs ? import <nixpkgs> { } }:
let
inherit (pkgs) recurseIntoAttrs stdenv;
inherit (pkgs.lib) deepSeq filterAttrs hasPrefix isDerivation mapAttrs pipe;
selectDerivations = set:
let
# Check if a given derivation must be built in the current system.
shouldBuildForPlatform = system: drv:
builtins.elem system (drv.meta.hydraPlatforms or drv.meta.platforms or [ system ]);
derivationTree = value:
# Output derivations directly, but only if they're compatible
# with this platform.
if isDerivation value && shouldBuildForPlatform pkgs.system value
then value
else if value.recurseForDerivations or false
then
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))
recurseIntoAttrs
]
else null;
in
derivationTree (recurseIntoAttrs set);
self = import ./. { inherit pkgs; };
in
{
lib = deepSeq (import ./lib/tests.nix { lib = pkgs.lib; }) { };
newPackages = selectDerivations self.packageSets.pkgs;
patchedPackages = selectDerivations self.packageSets.patches;
}