-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
94 lines (73 loc) · 2.43 KB
/
default.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
{ chan ? "e1843646b04fb564abf6330a9432a76df3269d2f"
, compiler ? "ghc864"
, withHoogle ? false
, doHoogle ? false
, doHaddock ? false
, enableLibraryProfiling ? false
, enableExecutableProfiling ? false
, strictDeps ? false
, isJS ? false
, asShell ? false
}:
let
# It's a shpadoinkle day
shpadoinkle = builtins.fetchGit {
url = https://gitlab.com/fresheyeball/Shpadoinkle.git;
rev = "5e0d0d2fcdd2e7d35a1808a113f29bc74b63d356";
ref = "master";
};
# Additional ignore patterns to keep the Nix src clean
ignorance = [
"*.md"
"figlet"
"*.nix"
"*.sh"
"*.yml"
];
# Get some utilities
inherit (import (shpadoinkle + "/nix/util.nix") { inherit compiler isJS; }) compilerjs gitignore;
# Build faster by doing less
chill = p: (pkgs.haskell.lib.overrideCabal p {
inherit enableLibraryProfiling enableExecutableProfiling;
}).overrideAttrs (_: {
inherit doHoogle doHaddock strictDeps;
});
# Overlay containing Shpadoinkle packages, and needed alterations for those packages
# as well as optimizations from Reflex Platform
shpadoinkle-overlay =
import (shpadoinkle + "/nix/overlay.nix") { inherit compiler isJS; };
# Haskell specific overlay (for you to extend)
haskell-overlay = hself: hsuper: { };
# Top level overlay (for you to extend)
Shpadoinkle-continuations-overlay = self: super: {
haskell = super.haskell //
{ packages = super.haskell.packages //
{ ${compilerjs} = super.haskell.packages.${compilerjs}.override (old: {
overrides = super.lib.composeExtensions (old.overrides or (_: _: {})) haskell-overlay;
});
};
};
};
# Complete package set with overlays applied
pkgs = import
(builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/${chan}.tar.gz";
}) {
overlays = [
shpadoinkle-overlay
Shpadoinkle-continuations-overlay
];
};
# We can name him George
Shpadoinkle-continuations = pkgs.haskell.packages.${compilerjs}.callCabal2nix "Shpadoinkle-continuations" (gitignore ignorance ./.) {};
in with pkgs; with lib; with haskell.packages.${compiler};
if inNixShell || asShell
then shellFor {
inherit withHoogle;
packages = _: [Shpadoinkle-continuations];
COMPILER = compilerjs;
buildInputs = [ stylish-haskell cabal-install ghcid ];
shellHook = ''
${lolcat}/bin/lolcat ${./figlet}
'';
} else chill Shpadoinkle-continuations