|
| 1 | +commonLib: # the iohk-nix commonLib |
| 2 | +{ packages ? [] |
| 3 | +, required-name ? "required" |
| 4 | +, other-packages ? {} |
| 5 | +, config ? {} |
| 6 | +, package-set-path # usually import ./. {} |
| 7 | +}: |
| 8 | +{ system ? builtins.currentSystem |
| 9 | +, pkgs ? commonLib.getPkgs { inherit system config; } |
| 10 | + |
| 11 | +, scrubJobs ? true |
| 12 | +, supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ] |
| 13 | +, nixpkgsArgs ? { |
| 14 | + config = config // { allowUnfree = false; inHydra = true; }; |
| 15 | + } |
| 16 | +}: |
| 17 | +with (import (commonLib.nixpkgs + "/pkgs/top-level/release-lib.nix") { |
| 18 | + inherit supportedSystems scrubJobs nixpkgsArgs; |
| 19 | + packageSet = import package-set-path; |
| 20 | +}); |
| 21 | +with pkgs.lib; |
| 22 | +let |
| 23 | + |
| 24 | + |
| 25 | + traceId = x: builtins.trace (builtins.deepSeq x x) x; |
| 26 | + |
| 27 | + packageSet = import package-set-path {}; |
| 28 | + nix-tools-pkgs = supportedSystems: { |
| 29 | + nix-tools.libs = |
| 30 | + mapAttrs (_: _: supportedSystems) |
| 31 | + (filterAttrs (n: v: builtins.elem n packages && v != null) packageSet.nix-tools.libs); |
| 32 | + nix-tools.exes = |
| 33 | + mapAttrs (_: mapAttrs (_: _: supportedSystems)) |
| 34 | + (filterAttrs (n: v: builtins.elem n packages && v != null) packageSet.nix-tools.exes); |
| 35 | + nix-tools.tests = |
| 36 | + mapAttrs (_: mapAttrs (_: _: supportedSystems)) |
| 37 | + (filterAttrs (n: v: builtins.elem n packages && v != null) packageSet.nix-tools.tests); |
| 38 | + nix-tools.benchmarks = |
| 39 | + mapAttrs (_: mapAttrs (_: _: supportedSystems)) |
| 40 | + (filterAttrs (n: v: builtins.elem n packages && v != null) packageSet.nix-tools.benchmarks); |
| 41 | + }; |
| 42 | + |
| 43 | + mapped-pkgs = mapTestOn (nix-tools-pkgs supportedSystems); |
| 44 | + mapped-pkgs-mingw32 = mapTestOnCross lib.systems.examples.mingwW64 (nix-tools-pkgs [ "x86_64-linux" ]); |
| 45 | + |
| 46 | + mapped-pkgs-all |
| 47 | + = lib.recursiveUpdate |
| 48 | + (mapped-pkgs) |
| 49 | + (lib.mapAttrs (_: (lib.mapAttrs (_: (lib.mapAttrs' (n: v: lib.nameValuePair (lib.systems.examples.mingwW64.config + "-" + n) v))))) |
| 50 | + mapped-pkgs-mingw32); |
| 51 | + |
| 52 | +in fix (self: other-packages // mapped-pkgs-all |
| 53 | +// { |
| 54 | +# forceNewEval = pkgs.writeText "forceNewEval" chain.rev; |
| 55 | + |
| 56 | + required = pkgs.lib.hydraJob (pkgs.releaseTools.aggregate { |
| 57 | + name = required-name; |
| 58 | + constituents = with self; |
| 59 | + [ # forceNewEval |
| 60 | + ] ++ builtins.attrNames other-packages |
| 61 | + ++ map (pkg: [ nix-tools.exes.${pkg}.x86_64-darwin |
| 62 | + nix-tools.exes.${pkg}.x86_64-linux |
| 63 | + nix-tools.libs.${pkg}.x86_64-darwin |
| 64 | + nix-tools.libs.${pkg}.x86_64-linux ]) packages; |
| 65 | +# (packages ++ map (pkg: lib.systems.examples.mingwW64.config + "-" + pkg) packages); |
| 66 | + }); |
| 67 | + |
| 68 | +}) |
0 commit comments