diff options
Diffstat (limited to 'tvix/utils.nix')
-rw-r--r-- | tvix/utils.nix | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tvix/utils.nix b/tvix/utils.nix new file mode 100644 index 000000000000..ed751566bd9c --- /dev/null +++ b/tvix/utils.nix @@ -0,0 +1,23 @@ +{ lib, depot, ... }: + +{ + mkFeaturePowerset = { crateName, features, override ? { } }: + let + powerset = xs: + let + addElement = set: element: + set ++ map (e: [ element ] ++ e) set; + in + lib.foldl' addElement [ [ ] ] xs; + in + lib.listToAttrs (map + (featuresPowerset: { + name = if featuresPowerset != [ ] then "with-features-${lib.concatStringsSep "-" featuresPowerset}" else "no-features"; + value = depot.tvix.crates.workspaceMembers.${crateName}.build.override (old: { + runTests = true; + features = featuresPowerset; + } // (if lib.isFunction override then override old else override) + ); + }) + (powerset features)); +} |