forked from agda/cornelis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
78 lines (71 loc) · 2.49 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
{
description = "Agda mode for vim";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = { url = "github:edolstra/flake-compat"; flake = false; };
# See https://github.com/isovector/cornelis#agda-version
agda.url = "github:agda/agda/v2.6.4";
agda.inputs.flake-utils.follows = "flake-utils";
agda.inputs.nixpkgs.follows = "nixpkgs";
agda-stdlib-source = { url = "github:agda/agda-stdlib/v1.7.3"; flake = false; };
};
outputs = { self, nixpkgs, ... }@inputs:
let
name = "cornelis";
# Update `./.github/workflows/nix.yml` if changed.
# `ghc902` excluded due to build issues.
ghcVersions = map (v: "ghc${v}") [ "8107" "928" "947" "963" ];
# Ensure resolver in `./stack.yaml` is in sync with `defaultGhcVersion`.
defaultGhcVersion = "ghc947";
in
{
overlays = {
${name} = final: prev: {
haskell = prev.haskell // {
packageOverrides = final.lib.composeExtensions
prev.haskell.packageOverrides
(hfinal: hprev: {
${name} = hfinal.callCabal2nix name ./. { };
});
};
${name} = final.haskell.packages.${defaultGhcVersion}.${name};
vimPlugins = prev.vimPlugins.extend (pfinal: _: {
${name} = final.vimUtils.buildVimPluginFrom2Nix {
pname = name;
inherit (final.${name}) version;
src = ./.;
dependencies = builtins.attrValues {
inherit (pfinal) nvim-hs-vim vim-textobj-user;
};
};
});
};
};
} // inputs.flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.${name} inputs.agda.overlay ];
};
agda = pkgs.agda.withPackages (p: nixpkgs.lib.singleton (
p.standard-library.overrideAttrs (_: {
version = "1.7.3";
src = inputs.agda-stdlib-source;
})
));
in
{
packages = {
inherit agda;
${name} = pkgs.${name};
"${name}-vim" = pkgs.vimPlugins.${name};
default = pkgs.${name};
# Create `cornelis` package for all `ghcVersions`.
} // builtins.listToAttrs (map
(v: { name = "${name}-${v}"; value = pkgs.haskell.packages.${v}.${name}; })
ghcVersions
);
}
);
}