|
11 | 11 | nixpkgs-2305 = { url = "github:NixOS/nixpkgs/nixpkgs-23.05-darwin"; };
|
12 | 12 | nixpkgs-unstable = { url = "github:NixOS/nixpkgs/nixpkgs-unstable"; };
|
13 | 13 | flake-compat = { url = "github:input-output-hk/flake-compat/hkm/gitlab-fix"; flake = false; };
|
14 |
| - flake-utils = { url = "github:hamishmack/flake-utils/hkm/nested-hydraJobs"; }; |
15 | 14 | "hls-1.10" = { url = "github:haskell/haskell-language-server/1.10.0.0"; flake = false; };
|
16 | 15 | "hls-2.0" = { url = "github:haskell/haskell-language-server/2.0.0.1"; flake = false; };
|
17 | 16 | hydra.url = "hydra";
|
|
66 | 65 | };
|
67 | 66 | };
|
68 | 67 |
|
69 |
| - outputs = { self, nixpkgs, nixpkgs-unstable, nixpkgs-2105, nixpkgs-2111, nixpkgs-2205, nixpkgs-2211, nixpkgs-2305, flake-compat, flake-utils, ... }@inputs: |
| 68 | + outputs = { self, nixpkgs, nixpkgs-unstable, nixpkgs-2105, nixpkgs-2111, nixpkgs-2205, nixpkgs-2211, nixpkgs-2305, flake-compat, ... }@inputs: |
70 | 69 | let
|
71 | 70 | callFlake = import flake-compat;
|
72 | 71 |
|
73 | 72 | compiler = "ghc928";
|
74 | 73 | config = import ./config.nix;
|
75 | 74 |
|
| 75 | + inherit (nixpkgs) lib; |
| 76 | + |
76 | 77 | traceNames = prefix: builtins.mapAttrs (n: v:
|
77 | 78 | if builtins.isAttrs v
|
78 | 79 | then if v ? type && v.type == "derivation"
|
|
91 | 92 | "aarch64-darwin"
|
92 | 93 | ];
|
93 | 94 |
|
| 95 | + forEachSystem = lib.genAttrs systems; |
94 | 96 | in traceHydraJobs ({
|
95 | 97 | inherit config;
|
96 | 98 | overlay = self.overlays.combined;
|
|
104 | 106 | sources = inputs;
|
105 | 107 |
|
106 | 108 | overlaysOverrideable = import ./overlays;
|
| 109 | + |
107 | 110 | # Compatibility with old default.nix
|
108 |
| - compat = { checkMaterialization ? |
109 |
| - false # Allows us to easily switch on materialization checking |
110 |
| - , system, sourcesOverride ? { }, ... }@args: rec { |
| 111 | + compat = |
| 112 | + { checkMaterialization ? false # Allows us to easily switch on materialization checking |
| 113 | + , system |
| 114 | + , sourcesOverride ? { } |
| 115 | + , ... |
| 116 | + }@args: |
| 117 | + rec { |
111 | 118 | sources = inputs // sourcesOverride;
|
112 | 119 | allOverlays = import ./overlays (args // { inherit sources; });
|
113 | 120 | inherit config;
|
114 | 121 | # We are overriding 'overlays' and 'nixpkgsArgs' from the
|
115 | 122 | # flake outputs so that we can incorporate the args passed
|
116 | 123 | # to the compat layer (e.g. sourcesOverride).
|
117 | 124 | overlays = [ allOverlays.combined ]
|
118 |
| - ++ (if checkMaterialization then |
119 |
| - [ |
| 125 | + ++ lib.optional checkMaterialization |
120 | 126 | (final: prev: {
|
121 | 127 | haskell-nix = prev.haskell-nix // {
|
122 | 128 | checkMaterialization = true;
|
123 | 129 | };
|
124 |
| - }) |
125 |
| - ] |
126 |
| - else |
127 |
| - [ ]); |
| 130 | + }); |
128 | 131 | nixpkgsArgs = {
|
129 | 132 | inherit config overlays;
|
130 | 133 | };
|
|
146 | 149 | };
|
147 | 150 | };
|
148 | 151 |
|
| 152 | + legacyPackages = forEachSystem (system: |
| 153 | + (self.internal.compat { inherit system; }).pkgs); |
| 154 | + |
| 155 | + legacyPackagesUnstable = forEachSystem (system: |
| 156 | + (self.internal.compat { inherit system; }).pkgs-unstable); |
| 157 | + |
| 158 | + # Exposed so that buildkite can check that `allow-import-from-derivation=false` works for core of haskell.nix |
| 159 | + roots = forEachSystem (system: |
| 160 | + self.legacyPackagesUnstable.${system}.haskell-nix.roots compiler); |
| 161 | + |
149 | 162 | # Note: `nix flake check` evaluates outputs for all platforms, and haskell.nix
|
150 | 163 | # uses IFD heavily, you have to have the ability to build for all platforms
|
151 | 164 | # supported by haskell.nix, e.g. with remote builders, in order to check this flake.
|
152 | 165 | # If you want to run the tests for just your platform, run `./test/tests.sh` or
|
153 | 166 | # `nix-build -A checks.$PLATFORM`
|
154 |
| - } // flake-utils.lib.eachSystem systems (system: |
155 |
| - let |
156 |
| - legacyPackages = (self.internal.compat { inherit system; }).pkgs; |
157 |
| - nix-tools-hydraJobs = |
158 |
| - let cf = callFlake { pkgs = legacyPackages; inherit system; src = ./nix-tools; }; |
159 |
| - in cf.defaultNix.hydraJobs; |
160 |
| - in rec { |
161 |
| - inherit legacyPackages; |
162 |
| - legacyPackagesUnstable = (self.internal.compat { inherit system; }).pkgs-unstable; |
163 |
| - |
164 |
| - # FIXME: Currently `nix flake check` requires `--impure` because coverage-golden |
165 |
| - # (and maybe other tests) import projects that use builtins.currentSystem |
166 |
| - checks = builtins.listToAttrs (map (pkg: { |
167 |
| - name = pkg.name; |
168 |
| - value = pkg; |
169 |
| - }) (nixpkgs.lib.collect nixpkgs.lib.isDerivation (import ./test rec { |
170 |
| - haskellNix = self.internal.compat { inherit system; }; |
171 |
| - compiler-nix-name = compiler; |
172 |
| - pkgs = haskellNix.pkgs; |
173 |
| - }))); |
174 |
| - # Exposed so that buildkite can check that `allow-import-from-derivation=false` works for core of haskell.nix |
175 |
| - roots = legacyPackagesUnstable.haskell-nix.roots compiler; |
176 |
| - |
177 |
| - packages = (self.internal.compat { inherit system; }).hix.apps; |
178 |
| - |
179 |
| - allJobs = |
180 |
| - let |
181 |
| - inherit (import ./ci-lib.nix { pkgs = legacyPackagesUnstable; }) stripAttrsForHydra filterDerivations; |
182 |
| - ci = import ./ci.nix { inherit (self.internal) compat; inherit system; }; |
183 |
| - in stripAttrsForHydra (filterDerivations ci); |
184 |
| - |
185 |
| - requiredJobs = |
186 |
| - let |
187 |
| - inherit (legacyPackages) lib; |
188 |
| - names = x: lib.filter (n: n != "recurseForDerivations" && n != "meta") |
189 |
| - (builtins.attrNames x); |
190 |
| - in |
191 |
| - builtins.listToAttrs ( |
192 |
| - lib.concatMap (nixpkgsVer: |
193 |
| - let nixpkgsJobs = allJobs.${nixpkgsVer}; |
194 |
| - in lib.concatMap (compiler-nix-name: |
195 |
| - let ghcJobs = nixpkgsJobs.${compiler-nix-name}; |
196 |
| - in builtins.map (crossPlatform: { |
197 |
| - name = "required-${nixpkgsVer}-${compiler-nix-name}-${crossPlatform}"; |
198 |
| - value = legacyPackages.releaseTools.aggregate { |
199 |
| - name = "haskell.nix-${nixpkgsVer}-${compiler-nix-name}-${crossPlatform}"; |
200 |
| - meta.description = "All ${nixpkgsVer} ${compiler-nix-name} ${crossPlatform} jobs"; |
201 |
| - constituents = lib.collect lib.isDerivation ghcJobs.${crossPlatform}; |
202 |
| - }; |
203 |
| - }) (names ghcJobs) |
204 |
| - ) (names nixpkgsJobs) |
205 |
| - ) (names allJobs)); |
206 |
| - |
207 |
| - hydraJobs = |
208 |
| - allJobs |
| 167 | + # FIXME: Currently `nix flake check` requires `--impure` because coverage-golden |
| 168 | + # (and maybe other tests) import projects that use builtins.currentSystem |
| 169 | + checks = forEachSystem (system: |
| 170 | + builtins.listToAttrs ( |
| 171 | + map |
| 172 | + (pkg: { name = pkg.name; value = pkg; }) |
| 173 | + (lib.collect |
| 174 | + lib.isDerivation |
| 175 | + (import ./test |
| 176 | + rec { |
| 177 | + haskellNix = self.internal.compat { inherit system; }; |
| 178 | + compiler-nix-name = compiler; |
| 179 | + pkgs = haskellNix.pkgs; |
| 180 | + }) |
| 181 | + ) |
| 182 | + ) |
| 183 | + ); |
| 184 | + |
| 185 | + packages = forEachSystem (system: |
| 186 | + (self.internal.compat { inherit system; }).hix.apps |
| 187 | + ); |
| 188 | + |
| 189 | + allJobs = forEachSystem (system: |
| 190 | + let |
| 191 | + inherit (import ./ci-lib.nix { pkgs = self.legacyPackagesUnstable.${system}; }) stripAttrsForHydra filterDerivations; |
| 192 | + ci = import ./ci.nix { inherit (self.internal) compat; inherit system; }; |
| 193 | + in stripAttrsForHydra (filterDerivations ci)); |
| 194 | + |
| 195 | + requiredJobs = forEachSystem (system: |
| 196 | + let |
| 197 | + inherit (self.legacyPackages.${system}) lib; |
| 198 | + names = x: lib.filter (n: n != "recurseForDerivations" && n != "meta") |
| 199 | + (builtins.attrNames x); |
| 200 | + in |
| 201 | + builtins.listToAttrs ( |
| 202 | + lib.concatMap (nixpkgsVer: |
| 203 | + let nixpkgsJobs = self.allJobs.${system}.${nixpkgsVer}; |
| 204 | + in lib.concatMap (compiler-nix-name: |
| 205 | + let ghcJobs = nixpkgsJobs.${compiler-nix-name}; |
| 206 | + in builtins.map (crossPlatform: { |
| 207 | + name = "required-${nixpkgsVer}-${compiler-nix-name}-${crossPlatform}"; |
| 208 | + value = self.legacyPackages.${system}.releaseTools.aggregate { |
| 209 | + name = "haskell.nix-${nixpkgsVer}-${compiler-nix-name}-${crossPlatform}"; |
| 210 | + meta.description = "All ${nixpkgsVer} ${compiler-nix-name} ${crossPlatform} jobs"; |
| 211 | + constituents = lib.collect lib.isDerivation ghcJobs.${crossPlatform}; |
| 212 | + }; |
| 213 | + }) (names ghcJobs) |
| 214 | + ) (names nixpkgsJobs) |
| 215 | + ) (names self.allJobs.${system}))); |
| 216 | + |
| 217 | + hydraJobs = forEachSystem (system: |
| 218 | + self.allJobs.${system} |
| 219 | + // |
| 220 | + { |
209 | 221 | # Include hydraJobs from nix-tools subflake.
|
210 | 222 | # NOTE: These derivations do not depend on the haskell.nix in ./. but
|
211 | 223 | # on the version of haskell.nix locked in the subflake. They are
|
212 | 224 | # evaluated within their own flake and independently of anything
|
213 | 225 | # else. Here we only expose them in the main flake.
|
214 |
| - // { nix-tools = nix-tools-hydraJobs.${system} or {}; }; |
| 226 | + nix-tools = (callFlake { |
| 227 | + inherit system; |
| 228 | + pkgs = self.legacyPackages.${system}; |
| 229 | + src = ./nix-tools; |
| 230 | + }).defaultNix.hydraJobs or {}; |
| 231 | + }); |
215 | 232 |
|
216 |
| - devShells = with self.legacyPackages.${system}; { |
| 233 | + devShells = forEachSystem (system: |
| 234 | + let inherit (self.legacyPackages.${system}) mkShell nixUnstable cabal-install haskell-nix; |
| 235 | + in { |
217 | 236 | default =
|
218 | 237 | mkShell {
|
219 | 238 | buildInputs = [
|
|
222 | 241 | haskell-nix.compiler.${compiler}
|
223 | 242 | ];
|
224 | 243 | };
|
225 |
| - } // __mapAttrs (compiler-nix-name: compiler: |
| 244 | + } // builtins.mapAttrs (compiler-nix-name: compiler: |
226 | 245 | mkShell {
|
227 | 246 | buildInputs = [
|
228 | 247 | compiler
|
|
237 | 256 | "ghc881" "ghc882" "ghc883"
|
238 | 257 | "ghc8101" "ghc8102" "ghc8103" "ghc8104" "ghc8105" "ghc8106" "ghc810420210212"
|
239 | 258 | "ghc901"
|
240 |
| - "ghc921" "ghc922" "ghc923"]); |
241 |
| - })); |
| 259 | + "ghc921" "ghc922" "ghc923"]) |
| 260 | + ); |
| 261 | + }); |
242 | 262 |
|
243 | 263 | # --- Flake Local Nix Configuration ----------------------------
|
244 | 264 | nixConfig = {
|
|
0 commit comments