-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
85 lines (85 loc) · 2.66 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
{
description = "haskell-fri-proofs";
inputs = {
flake-utils = {
url = "github:numtide/flake-utils";
};
lint-utils = {
url = "git+https://gitlab.homotopic.tech/nix/lint-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
horizon-orbis = {
url = "git+ssh://[email protected]/Orbis-Tertius/horizon-orbis";
};
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
};
outputs =
inputs@
{ self
, flake-utils
, horizon-orbis
, lint-utils
, nixpkgs
, ...
}:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
pkgs = import nixpkgs { inherit system; };
hsPkgs =
with pkgs.haskell.lib;
pkgs.haskell.packages.ghc942.override
{
overrides = hfinal: hprev:
horizon-orbis.packages.x86_64-linux //
{
generic-monoid = doJailbreak (hprev.callHackage "generic-monoid" "0.1.0.1" { });
fri-proofs = disableLibraryProfiling (hprev.callCabal2nix "fri-proofs" ./. { });
fri-proofs-spec = disableLibraryProfiling (hprev.callCabal2nix "fri-proofs:spec" ./. { });
};
};
ormolu-check =
pkgs.stdenv.mkDerivation {
name = "ormolu-check";
src = ./.;
buildPhase = ''
${pkgs.git.outPath}/bin/git init
${pkgs.git.outPath}/bin/git add -A
${pkgs.git.outPath}/bin/git config user.email "[email protected]"
${pkgs.git.outPath}/bin/git config user.name "Foobar"
${pkgs.git.outPath}/bin/git commit -m "initial commit"
${pkgs.ormolu.outPath}/bin/ormolu -m inplace $(find ./. -type f -name '*.hs')
if [ -z "$(${pkgs.git.outPath}/bin/git status --porcelain)" ]; then
echo "ok"
else
echo "ormolu check failed"
exit 1
fi
'';
installPhase = ''
mkdir -p $out
'';
};
in
{
devShells.default = hsPkgs.fri-proofs.env.overrideAttrs (attrs: {
buildInputs = attrs.buildInputs ++ [
hsPkgs.cabal-install
hsPkgs.ghcid
pkgs.nixpkgs-fmt
pkgs.ghcid
pkgs.ormolu
hsPkgs.hlint
];
});
packages.default = hsPkgs.fri-proofs;
packages.ormolu-check = ormolu-check;
checks =
{
hlint = lint-utils.outputs.linters.${system}.hlint self;
hpack = lint-utils.outputs.linters.${system}.hpack self;
nixpkgs-fmt = lint-utils.outputs.linters.${system}.nixpkgs-fmt self;
inherit ormolu-check;
spec = hsPkgs.fri-proofs-spec;
};
});
}