-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
66 lines (65 loc) · 2.41 KB
/
flake.nix
File metadata and controls
66 lines (65 loc) · 2.41 KB
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
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
flake-utils.url = "flake-utils";
stacklock2nix.url = "github:cdepillabout/stacklock2nix";
};
outputs = { self, flake-utils, nixpkgs, stacklock2nix }:
let
supportedSystems =
[ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" "aarch64-linux" ];
compilerVersion = "966";
in flake-utils.lib.eachSystem supportedSystems (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ stacklock2nix.overlay ];
};
appendGhcFlags = opts: drv:
pkgs.haskell.lib.appendBuildFlag drv
''--ghc-options="${builtins.concatStringsSep " " opts}"'';
insaneOptimizationFlags =
[ "-O2" "-fexpose-all-unfoldings" "-fspecialise-aggressively" ];
justStatic = package:
(pkgs.haskell.lib.overrideCabal
(pkgs.haskell.lib.justStaticExecutables package)
(drv: { disallowGhcReference = false; }));
in {
packages = {
default = justStatic (pkgs.stacklock2nix {
stackYaml = ./stack.yaml;
baseHaskellPkgSet = pkgs.haskell.packages."ghc${compilerVersion}";
additionalHaskellPkgSetOverrides = (hfinal: hprev:
builtins.mapAttrs (name: value:
if (builtins.tryEval (!(builtins.isAttrs value)
|| !(value ? pname))).value or true then
value
else if value ? doCheck && value.pname != "ghc" then
pkgs.lib.pipe value (with pkgs.haskell.lib; [
dontCheck
dontHaddock
doJailbreak
doStrip
disableLibraryProfiling
disableExecutableProfiling
(appendGhcFlags insaneOptimizationFlags)
])
else
value) hprev);
}).pkgSet.project-m36-rest;
};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
haskell.compiler."ghc${compilerVersion}"
(pkgs.haskell-language-server.override {
supportedGhcVersions = [ compilerVersion ];
})
];
};
});
nixConfig = {
extra-substituters = [ "https://cache.garnix.io" ];
extra-trusted-public-keys =
[ "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" ];
};
}