forked from typelead/eta
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.nix
More file actions
59 lines (53 loc) · 1.59 KB
/
default.nix
File metadata and controls
59 lines (53 loc) · 1.59 KB
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
with import <nixpkgs> { };
let
rootName = name: builtins.elemAt (lib.splitString "/" name) 0;
isValidFile = name: files: builtins.elem (rootName name) files;
relative = path: name: lib.removePrefix (toString path + "/") name;
onlyFiles = files: path: builtins.filterSource (name: type: isValidFile (relative path name) files) path;
eta-nix = fetchTarball "https://github.com/eta-lang/eta-nix/archive/1638c3f133a3931ec70bd0d4f579b67fd62897e2.tar.gz";
rewriteRelative = top: path:
let path' = lib.removePrefix top (builtins.toString path);
in if lib.isStorePath path' then path' else ./. + path';
overrides = self: super: {
mkDerivation = args: super.mkDerivation (lib.overrideExisting args {
src = rewriteRelative eta-nix args.src;
});
eta = haskell.lib.overrideCabal super.eta (drv: {
# Makes the build a bit faster
src = onlyFiles ["compiler" "include" "eta" "eta.cabal" "LICENSE" "tests"] drv.src;
});
};
hpkgs = (import eta-nix { }).override { inherit overrides; };
in
hpkgs // {
eta-build-shell = runCommand "eta-build-shell" {
# Libraries don't pass -encoding to javac.
LC_ALL = "en_US.utf8";
buildInputs = [
hpkgs.eta
hpkgs.eta-build
hpkgs.eta-pkg
hpkgs.etlas
gitMinimal
jdk
glibcLocales
];
} "";
shells = {
ghc = hpkgs.shellFor {
packages = p: [
p.eta
p.codec-jvm
p.eta-boot
p.eta-boot-meta
p.eta-meta
p.eta-repl
p.eta-pkg
p.etlas
p.etlas-cabal
p.hackage-security
p.shake
];
};
};
}