mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 19:46:07 +01:00
Filter derivation with preferLocalBuild
This commit is contained in:
parent
23aa551059
commit
26488e9a43
1 changed files with 23 additions and 3 deletions
26
ci.nix
26
ci.nix
|
|
@ -3,10 +3,30 @@
|
|||
|
||||
with import <nixpkgs> { };
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
src = import ./src;
|
||||
|
||||
attrs = genAttrs
|
||||
[ "aarch64" "i686" ]
|
||||
(arch: (src { 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
|
||||
|
||||
lib.genAttrs
|
||||
[ "aarch64" "i686" ]
|
||||
(arch: (src { inherit arch; }) // { recurseForDerivations = true; })
|
||||
concatMap outputsOf cachePkgs
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue