-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathflake.nix
124 lines (110 loc) · 3.93 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
{
description = "Slacklinker Slack link bot";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:mercurytechnologies/flake-compat";
flake = false;
};
};
nixConfig.allow-import-from-derivation = true; # cabal2nix uses IFD
outputs = { self, nixpkgs, flake-utils, ... }:
let
ghcVer = "ghc98";
out = system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
config.allowBroken = true;
config.allowUnfree = true;
};
in
{
packages = rec {
default = slacklinker;
slacklinker = pkgs.haskell.packages.${ghcVer}.slacklinker;
};
checks = {
inherit (self.packages.${system}) slacklinker;
};
# for debugging
inherit pkgs;
devShells.default =
let haskellPackages = pkgs.haskell.packages.${ghcVer};
in
haskellPackages.shellFor {
packages = p: [ self.packages.${system}.slacklinker ];
withHoogle = true;
buildInputs = with haskellPackages; [
haskell-language-server
fourmolu
# ghcid
cabal-install
# fast-tags
# friendly
] ++ (with pkgs; [
ngrok
sqlite
refinery-cli
postgresql
pgformatter # executable is called pg_format
cabal2nix
]);
# Change the prompt to show that you are in a devShell
# shellHook = "export PS1='\\e[1;34mdev > \\e[0m'";
};
};
in
flake-utils.lib.eachDefaultSystem out // {
# this stuff is *not* per-system
overlays = {
default = self: super: {
haskell = super.haskell // {
packages = super.haskell.packages // {
${ghcVer} = super.haskell.packages."${ghcVer}".override (oldArgs: {
overrides =
self.lib.fold
super.lib.composeExtensions
(oldArgs.overrides or (_: _: { }))
[ (self.haskell.lib.packageSourceOverrides {
slacklinker = ./.;
})
(self.haskell.lib.packagesFromDirectory {
directory = ./nix/deps;
})
(hself: hsuper: {
slacklinker =
import ./nix/build.nix
{ inherit super self hself hsuper;
werror = true;
testToolDepends = [
self.postgresql
self.refinery-cli
];
}
hsuper.slacklinker;
# broken bounds. as mercury people, you can fix this
# upstream :)
slack-web =
super.haskell.lib.doJailbreak hsuper.slack-web;
tmp-postgres =
super.haskell.lib.dontCheck hsuper.tmp-postgres;
# possible macOS lack-of-sandbox related breakage
http2 =
if super.stdenv.isDarwin
then super.haskell.lib.dontCheck hsuper.http2
else hsuper.http2;
# some kinda weird test issues on macOS
port-utils =
super.haskell.lib.dontCheck hsuper.port-utils;
})
];
});
};
};
};
};
};
}