|
5 | 5 | nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; |
6 | 6 | flake-utils.url = "github:numtide/flake-utils"; |
7 | 7 | nix-filter.url = "github:numtide/nix-filter"; |
8 | | - arrayfire-nix = { |
9 | | - url = "github:twesterhout/arrayfire-nix"; |
10 | | - inputs.flake-utils.follows = "flake-utils"; |
11 | | - inputs.nixpkgs.follows = "nixpkgs"; |
12 | | - }; |
13 | 8 | }; |
14 | 9 |
|
15 | 10 | outputs = inputs: |
|
30 | 25 | ]; |
31 | 26 | }; |
32 | 27 |
|
| 28 | + # Build ArrayFire from the official binary installer; avoids freeimage entirely. |
| 29 | + mkArrayfire = pkgs: pkgs.stdenv.mkDerivation rec { |
| 30 | + pname = "arrayfire"; |
| 31 | + version = "3.10.0"; |
| 32 | + src = pkgs.fetchurl { |
| 33 | + url = "https://arrayfire.s3.amazonaws.com/${version}/ArrayFire-v${version}_Linux_x86_64.sh"; |
| 34 | + hash = "sha256-8SibCWnRxts79S6WEHb3skF2TIDl1QnjY6EiohmoIog="; |
| 35 | + }; |
| 36 | + nativeBuildInputs = [ pkgs.autoPatchelfHook ]; |
| 37 | + buildInputs = with pkgs; [ |
| 38 | + stdenv.cc.cc.lib |
| 39 | + fftw |
| 40 | + fftwFloat |
| 41 | + openblas |
| 42 | + ocl-icd |
| 43 | + boost.out |
| 44 | + ]; |
| 45 | + unpackPhase = "true"; |
| 46 | + installPhase = '' |
| 47 | + mkdir -p $out |
| 48 | + bash $src --exclude-subdir --prefix=$out |
| 49 | + ''; |
| 50 | + meta = { |
| 51 | + description = "A general-purpose library for parallel and massively-parallel architectures"; |
| 52 | + platforms = [ "x86_64-linux" ]; |
| 53 | + }; |
| 54 | + }; |
| 55 | + |
| 56 | + arrayfire-overlay = self: super: { |
| 57 | + arrayfire = mkArrayfire self; |
| 58 | + }; |
| 59 | + |
33 | 60 | # An overlay that lets us test arrayfire-haskell with different GHC versions |
34 | 61 | arrayfire-haskell-overlay = self: super: { |
35 | 62 | haskell = super.haskell // { |
36 | 63 | packageOverrides = inputs.nixpkgs.lib.composeExtensions super.haskell.packageOverrides |
37 | 64 | (hself: hsuper: { |
38 | 65 | arrayfire = self.haskell.lib.appendConfigureFlags |
39 | | - (hself.callCabal2nix "arrayfire" src { af = self.arrayfire; }) |
| 66 | + (hself.callCabal2nix "arrayfire" src { |
| 67 | + af = self.arrayfire; |
| 68 | + }) |
40 | 69 | [ "-f disable-default-paths" ]; |
41 | 70 | }); |
42 | 71 | }; |
|
56 | 85 | doctest |
57 | 86 | hsc2hs |
58 | 87 | hspec-discover |
59 | | - # Language servers |
60 | | - haskell-language-server |
61 | 88 | nil |
62 | 89 | # Formatters |
63 | 90 | nixpkgs-fmt |
|
69 | 96 | pkgs-for = system: import inputs.nixpkgs { |
70 | 97 | inherit system; |
71 | 98 | overlays = [ |
72 | | - inputs.arrayfire-nix.overlays.default |
| 99 | + arrayfire-overlay |
73 | 100 | arrayfire-haskell-overlay |
74 | 101 | ]; |
75 | 102 | }; |
|
78 | 105 | packages = inputs.flake-utils.lib.eachDefaultSystemMap (system: |
79 | 106 | with (pkgs-for system); { |
80 | 107 | default = haskellPackages.arrayfire; |
81 | | - haskell = haskell.packages; |
82 | 108 | }); |
83 | 109 |
|
84 | 110 | devShells = inputs.flake-utils.lib.eachDefaultSystemMap (system: { |
|
0 commit comments