nix-on-droid/ci.nix

31 lines
739 B
Nix

# Copyright (c) 2019-2020, see AUTHORS. Licensed under MIT License, see LICENSE.
with import <nixpkgs> { };
with lib;
let
pkgs = import ./pkgs;
attrs = genAttrs
[ "aarch64" "i686" ]
(arch: (pkgs { inherit arch; }) // { recurseForDerivations = true; });
isCacheable = p: !(p.preferLocalBuild or false);
shouldRecurseForDerivations = p: isAttrs p && p.recurseForDerivations or false;
flattenPkgs = s:
let
f = p:
if shouldRecurseForDerivations p then flattenPkgs p
else if isDerivation p then [ p ]
else [ ];
in
concatMap f (attrValues s);
cachePkgs = filter isCacheable (flattenPkgs attrs);
outputsOf = p: map (o: p.${o}) p.outputs;
in
concatMap outputsOf cachePkgs