-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
92 lines (91 loc) · 2.77 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
{
nixConfig.bash-prompt = "[nix-develop-osl:] ";
description = "Orbis Specification Language compiler";
inputs = {
flake-utils = {
url = "github:numtide/flake-utils";
};
flake-compat-ci.url = "github:hercules-ci/flake-compat-ci";
lint-utils = {
url = "git+https://gitlab.homotopic.tech/nix/lint-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
horizon-orbis = {
url = "git+ssh://[email protected]/Orbis-Tertius/horizon-orbis";
};
};
outputs =
inputs@
{ self
, flake-utils
, flake-compat-ci
, horizon-orbis
, lint-utils
, nixpkgs
, ...
}:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
pkgs = import nixpkgs { inherit system; };
lintPkgs = import lint-utils.inputs.nixpkgs { inherit system; };
hsPkgs =
with pkgs.haskell.lib;
pkgs.haskell.packages.ghc942.override
{
overrides = hfinal: hprev:
horizon-orbis.packages.x86_64-linux // {
osl = dontCheck (disableLibraryProfiling (hprev.callCabal2nix "osl" ./. { }));
osl-spec = disableLibraryProfiling (hprev.callCabal2nix "osl:spec" ./. { });
};
};
ormolu-check =
pkgs.stdenv.mkDerivation {
name = "ormolu-check";
src = ./.;
doCheck = true;
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.osl.env.overrideAttrs (attrs: {
buildInputs = attrs.buildInputs ++ [
hsPkgs.cabal-install
pkgs.nixpkgs-fmt
hsPkgs.ghcid
pkgs.ormolu
hsPkgs.hlint
];
});
packages.default = hsPkgs.osl;
packages.ormolu-check = ormolu-check;
ciNix = flake-compat-ci.lib.recurseIntoFlakeWith {
flake = self;
systems = [ "x86_64-linux" ];
};
checks =
with lint-utils.outputs.linters.${system};
{
hlint = hlint self;
hpack = hpack self;
inherit ormolu-check;
spec = hsPkgs.osl-spec;
};
});
}