forked from agda/cornelis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
79 lines (72 loc) · 2.69 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
{
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/4d36cb37f8bfb765339b808b13356d760aa6f0ec";
agda.inputs.flake-utils.follows = "flake-utils";
agda.inputs.nixpkgs.follows = "nixpkgs";
agda-stdlib = { url = "github:agda/agda-stdlib/experimental"; 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" "924" "944" ];
# Ensure resolver in `./stack.yaml` is in sync ith `defaultGhcVersion`.
defaultGhcVersion = "ghc924";
# We use `ghc924` as default rather than `ghc925` (which would match current GHC version of
# resolver) since `ghc924` is default version in `nixpkgs` and so we get benefits of binary
# cache.
in
{
overlays = {
${name} = final: prev: {
haskell = prev.haskell // {
packageOverrides = final.lib.composeExtensions
prev.haskell.packageOverrides
(hfinal: _: { ${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 = "2.0-experimental";
src = inputs.agda-stdlib;
})
));
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
);
}
);
}