-
-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathflake.nix
63 lines (58 loc) · 1.82 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
{
description = "GRIN - Graph Reduction Intermediate Notation";
inputs = {
nixpkgs.follows = "haskellNix/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
haskellNix.url = "github:input-output-hk/haskell.nix";
};
outputs = { self, nixpkgs, flake-utils, haskellNix }:
flake-utils.lib.eachDefaultSystem (system:
let
llvm-overlay = self: super: {
llvm-config = self.llvm_7;
GRIN_CC = "${pkgs.clang_7}/bin/clang";
GRIN_OPT = "${pkgs.llvm_7}/bin/opt";
GRIN_LLC = "${pkgs.llvm_7}/bin/llc";
};
overlays = [ haskellNix.overlay
(final: prev: {
# This overlay adds our project to pkgs
grinProject =
final.haskell-nix.stackProject' {
name = "grin";
src = ./.;
compiler-nix-name = "ghc865";
};
})
llvm-overlay
];
pkgs = import nixpkgs { inherit system overlays; };
flake = pkgs.grinProject.flake {};
executable = "grin:exe:grin";
app = flake-utils.lib.mkApp {
name = "grin";
exePath = "/bin/grin";
drv = self.packages.${system}.${executable};
};
in flake // {
# Built by `nix build .`
defaultPackage = flake.packages.${executable};
# `nix run`
apps.grin = app;
defaultApp = app;
# This is used by `nix develop .` to open a shell for use with
# `cabal`, `hlint` and `haskell-language-server`
devShell = pkgs.grinProject.shellFor {
tools = {
cabal = "latest";
hlint = "latest";
haskell-language-server = "latest";
};
# Env
GRIN_CC = "${pkgs.clang_7}/bin/clang";
GRIN_OPT = "${pkgs.llvm_7}/bin/opt";
GRIN_LLC = "${pkgs.llvm_7}/bin/llc";
};
}
);
}