-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
164 lines (151 loc) · 5.23 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
{
inputs = {
nixpkgs_.url = "github:deemp/flakes?dir=source-flake/nixpkgs";
nixpkgs.follows = "nixpkgs_/nixpkgs";
my-codium.url = "github:deemp/flakes?dir=codium";
drv-tools.url = "github:deemp/flakes?dir=drv-tools";
flake-utils_.url = "github:deemp/flakes?dir=source-flake/flake-utils";
flake-utils.follows = "flake-utils_/flake-utils";
haskell-tools.url = "github:deemp/flakes?dir=language-tools/haskell";
my-devshell.url = "github:deemp/flakes?dir=devshell";
flakes-tools.url = "github:deemp/flakes?dir=flakes-tools";
workflows.url = "github:deemp/flakes?dir=workflows";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = inputs: inputs.flake-utils.lib.eachDefaultSystem (system:
let
pkgs = inputs.nixpkgs.legacyPackages.${system};
inherit (pkgs.lib.attrsets) genAttrs mapAttrs';
inherit (inputs.my-codium.lib.${system}) writeSettingsJSON mkCodium;
inherit (inputs.drv-tools.lib.${system}) mkShellApps mkBin mkShellApp mapGenAttrs mapStrGenAttrs;
inherit (inputs.my-codium.lib.${system}) extensions extensionsCommon settingsNix settingsCommonNix;
inherit (inputs.flakes-tools.lib.${system}) mkFlakesTools;
inherit (inputs.my-devshell.lib.${system}) mkCommands mkRunCommands mkShell;
inherit (inputs.workflows.lib.${system}) writeWorkflow;
inherit (inputs.haskell-tools.lib.${system}) toolsGHC;
inherit (inputs) workflows;
packageName = "clerk";
ghcVersion = "928";
override =
let inherit (pkgs.haskell.lib) doJailbreak dontCheck overrideCabal; in
{
overrides = self: super: {
"${packageName}" = overrideCabal (super.callCabal2nix packageName ./. { })
(x: {
librarySystemDepends = [
pkgs.zlib
pkgs.expat
pkgs.bzip2
] ++ (x.librarySystemDepends or [ ]);
libraryHaskellDepends = [
super.xlsx_1_1_0_1
] ++ (x.libraryHaskellDepends or [ ]);
});
};
};
inherit (toolsGHC {
version = ghcVersion;
inherit override;
packages = (ps: [ ps.${packageName} ]);
})
cabal ghcid hpack ghc implicit-hie hls;
scripts =
mkShellApps (
{
writeDocs = {
text = ''${cabal}/bin/cabal v1-test docs'';
};
}
//
(mapStrGenAttrs
(x: {
"example${x}" = {
text = "${cabal}/bin/cabal run example${x}";
description = "Get `example-${x}.xlsx`";
};
}) [ 1 2 3 4 ]
)
);
buildPrefix = "buildWithGHC";
ghcVersions = [
# "8107"
# "902"
"928"
# "945"
# "962"
];
cabalBuild = mkShellApps
(mapGenAttrs
(version: {
"${buildPrefix}${version}" =
let inherit (toolsGHC {
inherit version override; packages = (ps: [ ps.${packageName} ]);
}) cabal; in
{
name = "cabal-build";
text = "${cabal}/bin/cabal v1-build ${packageName}";
};
})
ghcVersions
)
;
tools = [
cabal
hpack
hls
ghcid
implicit-hie
pkgs.haskellPackages.fourmolu_0_12_0_0
];
packages = {
codium = mkCodium {
extensions = { inherit (extensions) nix haskell misc github markdown; };
runtimeDependencies = tools;
};
writeSettings = writeSettingsJSON (settingsCommonNix // {
inherit (settingsNix) haskell;
extra = {
"haskell.plugin.fourmolu.config.external" = true;
};
});
inherit (mkFlakesTools [ "." ]) updateLocks pushToCachix;
writeWorkflows = writeWorkflow "ci" (
import ./nix-files/workflow.nix {
inherit system workflows scripts buildPrefix ghcVersions;
}
);
} // cabalBuild // scripts;
devShells = {
default = mkShell {
packages = tools;
bash.extra = ''export LANG=C'';
commands =
mkCommands "tools" tools
++ mkRunCommands "ide" { "codium ." = packages.codium; inherit (packages) writeSettings; }
++ mkRunCommands "infra" { inherit (packages) writeWorkflows; }
++ mkRunCommands "test" { inherit (packages) example2 example3; }
++ mkRunCommands "scripts" { inherit (packages) writeDocs; };
};
};
in
{
inherit packages devShells;
});
nixConfig = {
extra-substituters = [
"https://haskell-language-server.cachix.org"
"https://nix-community.cachix.org"
"https://cache.iog.io"
"https://deemp.cachix.org"
];
extra-trusted-public-keys = [
"haskell-language-server.cachix.org-1:juFfHrwkOxqIOZShtC4YC1uT1bBcq2RSvC7OMKx0Nz8="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
"deemp.cachix.org-1:9shDxyR2ANqEPQEEYDL/xIOnoPwxHot21L5fiZnFL18="
];
};
}