forked from agda/agda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
61 lines (50 loc) · 1.83 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
{
description = "Agda is a dependently typed programming language / interactive theorem prover.";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }: (flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs { inherit system; overlays = [ self.overlay ]; };
in {
packages = {
inherit (pkgs.haskellPackages) Agda;
# TODO agda2-mode
};
defaultPackage = self.packages.${system}.Agda;
devShell = pkgs.haskellPackages.shellFor {
packages = ps: with ps; [ Agda ];
nativeBuildInputs = with pkgs; [
cabal-install
haskell-language-server
haskellPackages.fix-whitespace
# documentation
(python3.withPackages (ps: with ps; [
sphinx
sphinx_rtd_theme
]))
];
};
})) // {
overlay = final: prev: {
haskellPackages = prev.haskellPackages.override {
overrides = self.haskellOverlay;
};
};
haskellOverlay = final: prev: let
inherit (final) callCabal2nixWithOptions;
shortRev = builtins.substring 0 9 self.rev;
postfix = if self ? revCount then "${toString self.revCount}_${shortRev}" else "Dirty";
in {
# TODO use separate evaluation system?
Agda = callCabal2nixWithOptions "Agda" ./. "--flag enable-cluster-counting --flag optimise-heavily" ({
mkDerivation = args: final.mkDerivation (args // {
version = "${args.version}-pre${postfix}";
postInstall = "$out/bin/agda-mode compile";
# TODO Make check phase work
# At least requires:
# Setting AGDA_BIN (or using the Makefile, which at least requires cabal-install)
# Making agda-stdlib available (or disabling the relevant tests somehow)
doCheck = false;
});
});
};
};
}