-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
156 lines (147 loc) · 4.45 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
{
description = "Inspecting tool for the GHC pipeline through GHC plugin";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/master";
flake-utils.url = "github:numtide/flake-utils";
nixGL = {
url = "github:guibou/nixGL/main";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
fficxx = {
url = "github:wavewave/fficxx/master";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
hs-ogdf = {
url = "github:wavewave/hs-ogdf/master";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
fficxx.follows = "fficxx";
};
};
hs-imgui = {
url = "github:wavewave/hs-imgui/main";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
nixGL.follows = "nixGL";
fficxx.follows = "fficxx";
};
};
};
outputs = inputs @ {
self,
nixpkgs,
flake-utils,
nixGL,
fficxx,
hs-ogdf,
hs-imgui,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [
(hs-imgui.overlay.${system})
];
};
haskellOverlay = final: hself: hsuper: {
"criterion" = final.haskell.lib.doJailbreak hsuper.criterion;
"discrimination" = hself.callHackage "discrimination" "0.5" {};
"vector-binary-instances" = final.haskell.lib.doJailbreak hsuper.vector-binary-instances;
# ghc-specter-*
"ghc-specter-plugin" =
hself.callCabal2nix "ghc-specter-plugin" ./plugin {};
"ghc-specter-daemon" =
final.haskell.lib.overrideCabal
(hself.callCabal2nix "ghc-specter-daemon" ./daemon {})
(old: {
libraryFrameworkDepends =
final.lib.optional pkgs.stdenv.isDarwin final.darwin.apple_sdk.frameworks.Cocoa;
});
"ghc-build-analyzer" =
hself.callCabal2nix "ghc-build-analyzer" ./ghc-build-analyzer {};
};
hpkgsFor = compiler:
pkgs.haskell.packages.${compiler}.extend
(hself: hsuper:
fficxx.haskellOverlay.${system} pkgs hself hsuper
// hs-ogdf.haskellOverlay.${system} pkgs hself hsuper
// hs-imgui.haskellOverlay.${system} pkgs hself hsuper
// haskellOverlay pkgs hself hsuper);
mkEnvShellFor = compiler: let
hsenv = (hpkgsFor compiler).ghcWithPackages (
p: [
p.ghc-specter-daemon
p.ghc-specter-plugin
]
);
prompt = "ghc-specter:env";
in
pkgs.mkShell {
packages =
[
hsenv
pkgs.cabal-install
pkgs.alejandra
pkgs.ormolu
pkgs.zlib
]
++ (pkgs.lib.optional (pkgs.stdenv.isLinux && !pkgs.lib.inPureEvalMode) nixGL.packages.${system}.default);
shellHook = ''
export PS1="\n[${prompt}:\w]$ \0"
'';
};
mkDevShellFor = compiler: let
pyenv =
pkgs.python3.withPackages
(p: [p.sphinx p.sphinx_rtd_theme p.myst-parser]);
prompt = "ghc-specter:dev";
in
(hpkgsFor compiler).shellFor {
packages = p: [
p.ghc-specter-plugin
p.ghc-specter-daemon
];
buildInputs =
[
pkgs.cabal-install
pkgs.alejandra
pkgs.ormolu
pkgs.zlib
pyenv
]
++ (pkgs.lib.optional (pkgs.stdenv.isLinux && !pkgs.lib.inPureEvalMode) nixGL.packages.${system}.default)
++ (pkgs.lib.optionals (pkgs.stdenv.isDarwin) [pkgs.darwin.apple_sdk.frameworks.Cocoa]);
shellHook = ''
export PS1="\n[${prompt}:\w]$ \0"
'';
};
mkPackagesFor = compiler: {
inherit
(hpkgsFor compiler)
ghc-specter-plugin
ghc-specter-daemon
ghc-build-analyzer
;
};
defaultCompiler = "ghc962";
supportedCompilers = ["ghc962"];
in rec {
inherit haskellOverlay;
devShells =
pkgs.lib.genAttrs supportedCompilers mkDevShellFor
// {
default = devShells.${defaultCompiler};
env = mkEnvShellFor defaultCompiler;
};
packages = pkgs.lib.genAttrs supportedCompilers mkPackagesFor;
});
}