-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathflake.nix
66 lines (62 loc) · 2.33 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
{
description = "Agda core";
inputs.nixpkgs.url = github:NixOS/nixpkgs/eabe8d3eface69f5bb16c18f8662a702f50c20d5;
inputs.flake-utils.url = github:numtide/flake-utils;
inputs.mkAgdaDerivation.url = github:liesnikov/mkAgdaDerivation;
inputs.agda2hs = {
url = "github:liesnikov/agda2hs";
inputs.nixpkgs.follows = "nixpkgs";
inputs.mkAgdaDerivation.follows = "mkAgdaDerivation";
};
inputs.scope = {
url = "github:liesnikov/scope";
inputs.nixpkgs.follows = "nixpkgs";
inputs.mkAgdaDerivation.follows = "mkAgdaDerivation";
inputs.agda2hs.follows = "agda2hs";
};
outputs = {self, nixpkgs, flake-utils, mkAgdaDerivation, agda2hs, scope}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {inherit system;};
agdaDerivation = pkgs.callPackage mkAgdaDerivation.lib.mkAgdaDerivation {};
agda2hs-lib = agda2hs.packages.${system}.agda2hs-lib;
scope-lib = scope.packages.${system}.scope-lib;
compiler = "ghc96";
withCompiler = compiler:
let haskellPackages =
if compiler == "default"
then pkgs.haskellPackages
else pkgs.haskell.packages.${compiler};
agda2hs-custom = (agda2hs.lib.${system}.withCompiler compiler).withPackages [agda2hs-lib scope-lib];
in haskellPackages.callPackage ./nix/agda-core.nix {agda2hs = agda2hs-custom;};
agda-core = withCompiler compiler;
in {
packages = {
agda-core-lib = agdaDerivation
{ name = "agda-core-lib";
pname = "agda-core-lib";
meta = {};
libraryName = "agda-core";
libraryFile = "core.agda-lib";
tcDir = "src"; # typecheck all files in the src directory
buildInputs = [ agda2hs-lib scope-lib ];
src = ./.;
};
agda-core = agda-core;
default = agda-core;
};
lib = {
inherit withCompiler;
};
devShells.default = pkgs.haskellPackages.shellFor {
packages = p: [agda-core];
buildInputs = with pkgs.haskellPackages; [
cabal-install
cabal2nix
haskell-language-server
agda2hs-custom
(pkgs.agda.withPackages [ agda2hs-lib scope-lib ])
];
};
});
}