-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
79 lines (70 loc) · 3.08 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
{
description = "streamly-archive";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
ghcVersion = "965";
packageName = "streamly-archive";
config = {};
overlays = [
(final: prev:
let
haskellPkgs = final.haskell.packages."ghc${ghcVersion}";
in {
myHaskellPkgs = haskellPkgs.override {
overrides = hfinal: hprev: {
${packageName} =
hfinal.callCabal2nix packageName ./. {
archive = final.pkgs.libarchive;
};
# nixpkgs-unstable 4a4ecb0ab415c9fccfb005567a215e6a9564cdf5 (2024-06-03).
# We want Ormolu 0.7.4 for better commenting within if-else.
ormolu = hfinal.ormolu_0_7_4_0;
# This version of Ormolu requires ghc-lib-parser 9.8.x.
ghc-lib-parser = hfinal.ghc-lib-parser_9_8_2_20240223;
# Since we specify haskell-language-server below, we also need to bring a few more
# things in align with the same ghc-lib-parser. (The fourmolu and stylish-haskell
# lines should be avoidable by disabling those flags in haskell-language-server,
# but currently this seems non-trivial; see
# https://github.com/srid/haskell-flake/issues/245; see also
# configuration-ghc-9.2.x.nix in nixpkgs.)
fourmolu = hfinal.fourmolu_0_15_0_0;
ghc-lib-parser-ex = hfinal.ghc-lib-parser-ex_9_8_0_2;
hlint = hfinal.hlint_3_8;
stylish-haskell = hfinal.stylish-haskell_0_14_6_0;
};
};
${packageName} = final.myHaskellPkgs.${packageName};
myDevShell = final.myHaskellPkgs.shellFor {
packages = p: [p.${packageName}];
nativeBuildInputs = [
final.myHaskellPkgs.cabal-install
final.myHaskellPkgs.haskell-language-server
final.myHaskellPkgs.ormolu
];
# Without this, "cabal repl" shows "libarchive.so: cannot open
# shared...". See also:
# https://discourse.nixos.org/t/shared-libraries-error-with-cabal-repl-in-nix-shell/8921
shellHook = ''
export LD_LIBRARY_PATH=${final.pkgs.libarchive.lib}/lib
'';
};
})
];
pkgs = import nixpkgs { inherit config overlays system; };
in {
packages = {
default = pkgs.${packageName};
${packageName} = pkgs.${packageName};
"${packageName}-ci" =
pkgs.haskell.lib.overrideCabal
pkgs.${packageName}
(drv: { testFlags = ["--quickcheck-tests=500"]; });
};
devShells.default = pkgs.myDevShell;
});
}