-
Notifications
You must be signed in to change notification settings - Fork 3
/
flake.nix
160 lines (154 loc) · 5.82 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
{
description = "angelagesteira.com website";
inputs = {
nixpkgs-1803 = { url = "github:NixOS/nixpkgs/release-18.03"; flake = false; };
nixpkgs-2003 = { url = "github:NixOS/nixpkgs/release-20.03"; };
nixpkgs-2305 = { url = "github:NixOS/nixpkgs/release-23.05"; };
nixpkgs-2405 = { url = "github:NixOS/nixpkgs/release-24.05"; };
flake-utils = { url = "github:numtide/flake-utils"; };
nix-filter.url = "github:numtide/nix-filter";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs-2405";
};
outputs = { self, flake-utils, ... }@inputs:
let
pkgsFor = nixpkgs: system:
import nixpkgs {
inherit system;
overlays = [
self.overlays.default
inputs.nix-filter.overlays.default
];
};
src = inputs.nix-filter.lib {
root = ./.;
include = [
"src"
"test"
"assets"
"package.yaml"
];
};
in
{
overlays.default = final: prev: with final.haskell.lib; {
haskellPackages = prev.haskellPackages.override
(old: {
overrides = final.lib.composeExtensions
(old.overrides or (_: _: { }))
(self: super: {
autodocodec-yaml = unmarkBroken (doCheck super.autodocodec-yaml);
sydtest = unmarkBroken (dontCheck super.sydtest);
ghcaniuse = dontCheck (self.callCabal2nix "ghcaniuse" src { });
});
});
};
}
//
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = pkgs2405;
pkgs1803 = pkgsFor inputs.nixpkgs-1803 system;
pkgs2003 = pkgsFor inputs.nixpkgs-2003 system;
pkgs2305 = pkgsFor inputs.nixpkgs-2305 system;
pkgs2405 = pkgsFor inputs.nixpkgs-2405 system;
mkDerivationLanguageExtensions = name: ghc:
pkgs.stdenv.mkDerivation {
name = "language-extensions-for-${name}";
phases = [ "buildPhase" "installPhase" ];
buildInputs = [ ghc ];
buildPhase = "ghc --supported-languages > ${name}-languages.txt";
installPhase = "mkdir -p $out; cp ${name}-languages.txt $out";
};
ghcs = {
"ghc-7.0.4" = pkgs1803.haskell.compiler.ghc704;
"ghc-7.4.2" = pkgs1803.haskell.compiler.ghc742;
"ghc-7.6.3" = pkgs1803.haskell.compiler.ghc763;
"ghc-7.8.4" = pkgs1803.haskell.compiler.ghc784;
"ghc-7.10.3" = pkgs1803.haskell.compiler.ghc7103;
"ghc-8.0.2" = pkgs1803.haskell.compiler.ghc802;
"ghc-8.2.2" = pkgs1803.haskell.compiler.ghc822;
"ghc-8.4.4" = pkgs2003.haskell.compiler.ghc844;
"ghc-8.6.5" = pkgs2003.haskell.compiler.ghc865;
"ghc-8.8.4" = pkgs2305.haskell.compiler.ghc884;
"ghc-8.10.7" = pkgs2305.haskell.compiler.ghc8107;
"ghc-9.0.2" = pkgs2305.haskell.compiler.ghc902;
"ghc-9.2.8" = pkgs2405.haskell.compiler.ghc928;
"ghc-9.4.6" = pkgs2405.haskell.compiler.ghc946;
"ghc-9.6.5" = pkgs2405.haskell.compiler.ghc965;
"ghc-9.8.2" = pkgs2405.haskell.compiler.ghc982;
"ghc-9.10.1" = pkgs2405.haskell.compiler.ghc9101;
};
precommitCheck = inputs.pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
actionlint.enable = true;
hlint.enable = true;
hpack.enable = true;
markdownlint.enable = true;
nil.enable = true;
nixpkgs-fmt.enable = true;
ormolu.enable = true;
statix.enable = true;
};
};
in
rec {
packages = {
inherit (pkgs.haskellPackages) ghcaniuse;
ghc-language-extensions = pkgs.symlinkJoin {
name = "ghc-language-extensions";
paths = builtins.attrValues (
(builtins.mapAttrs mkDerivationLanguageExtensions)
ghcs
);
};
ghcaniuse-web = pkgs.stdenv.mkDerivation {
name = "ghcaniuse-web";
phases = [ "buildPhase" "installPhase" ];
buildPhase = apps.ghcaniuse-gen.program;
installPhase = ''
mkdir -p $out
cp index.html $out
'';
};
default = packages.ghcaniuse-web;
};
apps = {
ghcaniuse = flake-utils.lib.mkApp {
drv = pkgs.haskell.lib.justStaticExecutables (
packages.ghcaniuse.overrideAttrs (oldAttrs: {
configureFlags = oldAttrs.configureFlags ++ [ "--ghc-option=-O2" ];
})
);
};
ghcaniuse-gen = flake-utils.lib.mkApp {
drv = pkgs.writeShellScriptBin "ghcaniuse-gen" ''
${apps.ghcaniuse.program} \
--directory ${packages.ghc-language-extensions} $@
'';
};
default = apps.ghcaniuse-gen;
};
devShells = {
default = pkgs.haskellPackages.shellFor {
packages = p: [ (pkgs.haskell.lib.doCheck packages.ghcaniuse) ];
buildInputs = with pkgs; [
nixpkgs-fmt
cabal-install
hpack
ghcid
haskellPackages.implicit-hie
haskellPackages.calligraphy
haskell-language-server
];
inherit (precommitCheck) shellHook;
};
};
});
nixConfig = {
extra-substituters = "https://opensource.cachix.org";
extra-trusted-public-keys = "opensource.cachix.org-1:6t9YnrHI+t4lUilDKP2sNvmFA9LCKdShfrtwPqj2vKc=";
};
}