forked from agda/agda2hs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
57 lines (54 loc) · 1.91 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
{
description = "Agda2hs";
inputs.nixpkgs.url = github:NixOS/nixpkgs;
inputs.flake-utils.url = github:numtide/flake-utils;
outputs = {self, nixpkgs, flake-utils}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {inherit system;};
agda2hs-lib = pkgs.agdaPackages.mkDerivation
{ pname = "agda2hs";
meta = {};
version = "1.3";
preBuild = ''
echo "{-# OPTIONS --sized-types #-}" > Everything.agda
echo "module Everything where" >> Everything.agda
find lib -name '*.agda' | sed -e 's/lib\///;s/\//./g;s/\.agda$//;s/^/import /' >> Everything.agda
'';
src = ./.;
};
agda2hs-pkg = options:
pkgs.haskellPackages.haskellSrc2nix {
name = "agda2hs";
src = ./.;
extraCabal2nixOptions = options; #"--jailbreak"
};
# jailbreaking here because otherwise aeson has to be overridden and that triggers recompilation of a lot of dependencies
agda2hs-hs = pkgs.haskellPackages.callPackage (agda2hs-pkg "--jailbreak") {};
agda2hs-expr = import ./agda2hs.nix;
agda2hs = pkgs.callPackage agda2hs-expr {
inherit self;
agda2hs = agda2hs-hs;
inherit (pkgs.haskellPackages) ghcWithPackages;
};
in {
packages = {
inherit agda2hs-lib;
inherit (agda2hs) agda2hs;
default = agda2hs.agda2hs;
};
lib = {
inherit (agda2hs) withPackages;
inherit agda2hs-pkg agda2hs-hs agda2hs-expr;
};
devShells.default = pkgs.haskellPackages.shellFor {
packages = p: [agda2hs-hs];
buildInputs = with pkgs.haskellPackages; [
cabal-install
cabal2nix
haskell-language-server
pkgs.agda
];
};
});
}