Merge pull request #270774 from emilytrau/libbacktrace-musl
[NixPkgs.git] / pkgs / top-level / release-alternatives.nix
blob788f052eda52443ed699cb65fb7d9e98c2ab02c3
1 { pkgsFun ? import ../..
2 , lib ? import ../../lib
3 , supportedSystems ? ["x86_64-linux"]
4 , allowUnfree ? false }:
6 let
8   # called BLAS here, but also tests LAPACK
9   blasUsers = [
10     # "julia_07" "julia_10" "julia_11" "julia_13" "octave" "octaveFull"
11     "fflas-ffpack" "linbox" "R" "ipopt" "hpl" "rspamd" "octopus"
12     "superlu" "suitesparse_5_3" "suitesparse_4_4"
13     "suitesparse_4_2" "scs" "scalapack" "petsc" "cholmod-extra"
14     "arpack" "qrupdate" "libcint" "iml" "globalarrays" "arrayfire" "armadillo"
15     "xfitter" "lammps" "plink-ng" "quantum-espresso" "siesta"
16     "siesta-mpi" "shogun" "calculix" "csdp" "getdp" "giac" "gmsh" "jags"
17     "lammps" "lammps-mpi"
19     # requires openblas
20     # "caffe" "mxnet" "flint" "sage" "sageWithDoc"
22     # broken
23     # "gnss-sdr" "octave-jit" "openmodelica" "torch"
25     # subpackages
26     ["pythonPackages" "numpy"] ["pythonPackages" "prox-tv"] ["pythonPackages" "scs"]
27     ["pythonPackages" "pysparse"] ["pythonPackages" "cvxopt"]
28     # ["pythonPackages" "fenics"]
29     ["rPackages" "slfm"] ["rPackages" "SamplerCompare"]
30     # ["rPackages" "EMCluster"]
31     # ["ocamlPackages" "lacaml"]
32     # ["ocamlPackages" "owl"]
33     ["haskellPackages" "bindings-levmar"]
34   ] ++ lib.optionals allowUnfree [ "magma" ];
35   blas64Users = [
36     "rspamd" "sundials" "suitesparse_5_3" "suitesparse_4_4"
37     "suitesparse_4_2" "petsc" "cholmod-extra"
38     "arpack" "qrupdate" "iml" "globalarrays" "arrayfire"
39     "lammps" "plink-ng" "quantum-espresso"
40     "calculix" "csdp" "getdp" "jags"
41     "lammps" "lammps-mpi"
42     # ["ocamlPackages" "lacaml"]
43     ["haskellPackages" "bindings-levmar"]
44   ] ++ lib.optionals allowUnfree [ "magma" ];
45   blasProviders = system: [ "openblasCompat" "lapack-reference" "openblas" ]
46     ++ lib.optionals (allowUnfree && system.isx86) ["mkl" "mkl64"];
48   blas64Providers = [ "mkl64" "openblas"];
50   mapListToAttrs = xs: f: builtins.listToAttrs (map (name: {
51     name = if builtins.isList name
52            then builtins.elemAt name (builtins.length name - 1)
53            else name;
54     value = f name;
55   }) xs);
60   blas = mapListToAttrs supportedSystems (system': let system = lib.systems.elaborate { system = system'; };
61     in mapListToAttrs (blasProviders system) (provider: let
62       isILP64 = builtins.elem provider (["mkl64"] ++ lib.optional system.is64bit "openblas");
63       pkgs = pkgsFun {
64         config = { inherit allowUnfree; };
65         system = system';
66         overlays = [(self: super: {
67           lapack = super.lapack.override {
68             lapackProvider = if provider == "mkl64"
69                              then super.mkl
70                              else builtins.getAttr provider super;
71             inherit isILP64;
72           };
73           blas = super.blas.override {
74             blasProvider = if provider == "mkl64"
75                            then super.mkl
76                            else builtins.getAttr provider super;
77             inherit isILP64;
78           };
79         })];
80       };
81     in mapListToAttrs (if builtins.elem provider blas64Providers
82                        then blas64Users else blasUsers)
83                       (attr: if builtins.isList attr
84                              then lib.getAttrFromPath attr pkgs
85                              else builtins.getAttr attr pkgs)
87         // { recurseForDerivations = true; })
88       // { recurseForDerivations = true; })
89     // { recurseForDerivations = true; };
90   recurseForDerivations = true;