-
Notifications
You must be signed in to change notification settings - Fork 10
/
flake.nix
62 lines (59 loc) · 2.31 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
# nix flake init -t github:srid/haskell-flake
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
haskell-flake.url = "github:srid/haskell-flake";
};
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = nixpkgs.lib.systems.flakeExposed;
imports = [ inputs.haskell-flake.flakeModule ];
perSystem = { self', pkgs, ... }:
let
# NP: this is to support stack build within nix.
# Inspired from https://docs.haskellstack.org/en/stable/nix_integration/
# Wrap Stack to work with our Nix integration. We don't want to modify
# stack.yaml so non-Nix users don't notice anything.
# - no-nix: We don't want Stack's way of integrating Nix.
# --system-ghc # Use the existing GHC on PATH (will come from this Nix file)
# --no-install-ghc # Don't try to install GHC if no matching GHC found on PATH
stack-wrapped = pkgs.symlinkJoin {
name = "stack"; # will be available as the usual `stack` in terminal
paths = [ pkgs.stack ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/stack \
--add-flags "\
--nix \
--system-ghc \
--no-install-ghc \
"
'';
};
in {
haskellProjects.default = {
# packages.ling.root = ./.; # This value is detected based on .cabal files
# overrides = self: super: { };
devShell = {
tools = hp: {
BNFC = hp.BNFC;
stylish-haskell = hp.stylish-haskell;
hlint = hp.hlint;
ghc-make = hp.ghc-make;
hindent = hp.hindent;
pointfree = hp.pointfree;
hpack = hp.hpack;
stack = stack-wrapped;
# ghc-mod = hp.ghc-mod; => broken
# hfmt = hp.hfmt; => broken
# pointful = hp.pointful; => broken
};
# hlsCheck.enable = true;
};
};
# haskell-flake doesn't set the default package, but you can do it here.
packages.default = self'.packages.ling;
};
};
}