-
Notifications
You must be signed in to change notification settings - Fork 5
/
flake.nix
90 lines (83 loc) · 2.43 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{
description = "arrayfire/arrayfire-haskell: ArrayFire Haskell bindings";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
nix-filter.url = "github:numtide/nix-filter";
arrayfire-nix = {
url = "github:twesterhout/arrayfire-nix";
inputs.flake-utils.follows = "flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs:
let
src = inputs.nix-filter.lib {
root = ./.;
include = [
"cbits"
"exe"
"gen"
"include"
"src"
"test"
"arrayfire.cabal"
"README.md"
"CHANGELOG.md"
"LICENSE"
];
};
# An overlay that lets us test arrayfire-haskell with different GHC versions
arrayfire-haskell-overlay = self: super: {
haskell = super.haskell // {
packageOverrides = inputs.nixpkgs.lib.composeExtensions super.haskell.packageOverrides
(hself: hsuper: {
arrayfire = self.haskell.lib.appendConfigureFlags
(hself.callCabal2nix "arrayfire" src { af = self.arrayfire; })
[ "-f disable-default-paths" ];
});
};
};
devShell-for = pkgs:
let
ps = pkgs.haskellPackages;
in
ps.shellFor {
packages = ps: with ps; [ arrayfire ];
withHoogle = true;
buildInputs = with pkgs; [ ocl-icd ];
nativeBuildInputs = with pkgs; with ps; [
# Building and testing
cabal-install
doctest
hsc2hs
hspec-discover
# Language servers
haskell-language-server
nil
# Formatters
nixpkgs-fmt
];
shellHook = ''
'';
};
pkgs-for = system: import inputs.nixpkgs {
inherit system;
overlays = [
inputs.arrayfire-nix.overlays.default
arrayfire-haskell-overlay
];
};
in
{
packages = inputs.flake-utils.lib.eachDefaultSystemMap (system:
with (pkgs-for system); {
default = haskellPackages.arrayfire;
haskell = haskell.packages;
});
devShells = inputs.flake-utils.lib.eachDefaultSystemMap (system: {
default = devShell-for (pkgs-for system);
});
overlays.default = arrayfire-haskell-overlay;
};
}