-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
133 lines (124 loc) · 5.19 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
{
inputs.flakes.url = "github:deemp/flakes";
outputs = inputs:
let makeFlake = inputs.flakes.makeFlake; in
makeFlake {
inputs = {
inherit (inputs.flakes.all)
nixpkgs formatter codium drv-tools devshell
flakes-tools workflows haskell-tools;
};
perSystem = { inputs, system }:
let
pkgs = inputs.nixpkgs.legacyPackages.${system};
inherit (inputs.codium.lib.${system}) extensions extensionsCommon settingsNix settingsCommonNix writeSettingsJSON mkCodium;
inherit (inputs.devshell.lib.${system}) mkCommands mkRunCommands mkShell;
inherit (inputs.flakes-tools.lib.${system}) mkFlakesTools;
inherit (inputs.haskell-tools.lib.${system}) toolsGHC;
inherit (inputs.workflows.lib.${system}) writeWorkflow steps nixCI run stepsIf names os;
inherit (inputs.drv-tools.lib.${system}) mkShellApps getExe;
lima = "lima";
override = {
overrides = self: super: {
doctest-parallel = super.doctest-parallel_0_3_0_1;
${lima} = super.callCabal2nix lima ./${lima} { };
};
};
ghcVersion = "928";
# Next, set the desired GHC version
inherit (toolsGHC {
inherit override;
version = ghcVersion;
packages = ps: [ ps.${lima} ];
}) cabal ghc hls hpack fourmolu ghcid haskellPackages;
tools = [ ghc cabal hls hpack ghcid fourmolu ];
packages =
let
packages1 = mkShellApps { writeDocs.text = "${getExe cabal} test ${lima}:test:readme"; };
packages2 = {
default = haskellPackages.${lima};
sdist = (haskellPackages.buildFromCabalSdist haskellPackages.${lima}).overrideAttrs (_: { pname = "lima-sdist"; });
codium = mkCodium { extensions = extensionsCommon // { inherit (extensions) haskell; }; };
writeSettings = writeSettingsJSON (settingsCommonNix // { inherit (settingsNix) haskell; });
inherit (mkFlakesTools { dirs = [ "." ]; root = ./.; }) updateLocks pushToCachix format;
writeWorkflows = writeWorkflow "CI"
(
nixCI {
jobArgs = {
doPushToCachix = true;
cacheNixArgs = {
linuxGCEnabled = true;
linuxMaxStoreSize = 5100000000;
macosGCEnabled = true;
macosMaxStoreSize = 5100000000;
};
doUpdateLocks = true;
doCommit = false;
doSaveFlakes = false;
steps = dir:
stepsIf ("${names.matrix.os} == '${os.ubuntu-22}'")
(
let writeDocsName = "Write docs"; in
[
{
name = writeDocsName;
run = run.nixScript {
inherit dir;
name = packages1.writeDocs.pname;
};
}
{
name = "Commit & Push changes";
run = run.nix {
doCommit = true;
commitArgs.messages = [ (steps.format { }).name (steps.updateLocks { }).name writeDocsName ];
};
}
]
)
++ [
{
name = "Build lima";
run = run.nix_ { doInstall = true; scripts = [ "" "sdist" ]; };
}
];
};
}
);
};
in
packages1 // packages2;
devShells.default = mkShell {
packages = tools;
bash.extra = "export LC_ALL=C.UTF-8";
commands =
mkCommands "tools" tools
++ mkRunCommands "ide" { "codium ." = packages.codium; inherit (packages) writeSettings; }
++ [
{
name = "test";
category = "test";
help = "Build via `cabal`";
command = "cabal v1-test";
}
];
};
in
{
inherit packages devShells;
formatter = inputs.formatter.${system};
};
};
nixConfig = {
extra-substituters = [
"https://nix-community.cachix.org"
"https://cache.iog.io"
"https://deemp.cachix.org"
];
extra-trusted-public-keys = [
"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="
];
};
}