|
66 | 66 | }; |
67 | 67 | }; |
68 | 68 |
|
69 | | - outputs = { self, nixpkgs, nixpkgs-unstable, nixpkgs-2105, nixpkgs-2111, nixpkgs-2205, nixpkgs-2211, nixpkgs-2305, flake-utils, ... }@inputs: |
70 | | - let compiler = "ghc928"; |
| 69 | + outputs = { self, nixpkgs, nixpkgs-unstable, nixpkgs-2105, nixpkgs-2111, nixpkgs-2205, nixpkgs-2211, nixpkgs-2305, flake-compat, flake-utils, ... }@inputs: |
| 70 | + let |
| 71 | + callFlake = import flake-compat; |
| 72 | + |
| 73 | + compiler = "ghc928"; |
71 | 74 | config = import ./config.nix; |
72 | 75 |
|
73 | 76 | traceNames = prefix: builtins.mapAttrs (n: v: |
|
79 | 82 |
|
80 | 83 | traceHydraJobs = x: x // { inherit (traceNames "" x) hydraJobs; }; |
81 | 84 |
|
| 85 | + # systems supported by haskell.nix |
| 86 | + systems = [ |
| 87 | + "x86_64-linux" |
| 88 | + "x86_64-darwin" |
| 89 | + # TODO switch back on when ci.iog.io has builders for aarch64-linux |
| 90 | + # "aarch64-linux" |
| 91 | + "aarch64-darwin" |
| 92 | + ]; |
| 93 | + |
82 | 94 | in traceHydraJobs ({ |
83 | 95 | inherit config; |
84 | 96 | overlay = self.overlays.combined; |
85 | 97 | overlays = import ./overlays { sources = inputs; }; |
86 | | - internal = rec { |
| 98 | + internal = { |
87 | 99 | nixpkgsArgs = { |
88 | 100 | inherit config; |
89 | 101 | overlays = [ self.overlay ]; |
|
139 | 151 | # supported by haskell.nix, e.g. with remote builders, in order to check this flake. |
140 | 152 | # If you want to run the tests for just your platform, run `./test/tests.sh` or |
141 | 153 | # `nix-build -A checks.$PLATFORM` |
142 | | - } // flake-utils.lib.eachSystem [ |
143 | | - "x86_64-linux" |
144 | | - "x86_64-darwin" |
145 | | - # TODO switch back on when ci.iog.io has builders for aarch64-linux |
146 | | - # "aarch64-linux" |
147 | | - "aarch64-darwin" ] (system: rec { |
148 | | - legacyPackages = (self.internal.compat { inherit system; }).pkgs; |
149 | | - legacyPackagesUnstable = (self.internal.compat { inherit system; }).pkgs-unstable; |
150 | | - |
151 | | - # FIXME: Currently `nix flake check` requires `--impure` because coverage-golden |
152 | | - # (and maybe other tests) import projects that use builtins.currentSystem |
153 | | - checks = builtins.listToAttrs (map (pkg: { |
154 | | - name = pkg.name; |
155 | | - value = pkg; |
156 | | - }) (nixpkgs.lib.collect nixpkgs.lib.isDerivation (import ./test rec { |
157 | | - haskellNix = self.internal.compat { inherit system; }; |
158 | | - compiler-nix-name = compiler; |
159 | | - pkgs = haskellNix.pkgs; |
160 | | - }))); |
161 | | - # Exposed so that buildkite can check that `allow-import-from-derivation=false` works for core of haskell.nix |
162 | | - roots = legacyPackagesUnstable.haskell-nix.roots compiler; |
163 | | - |
164 | | - packages = (self.internal.compat { inherit system; }).hix.apps; |
165 | | - |
166 | | - allJobs = |
167 | | - let |
168 | | - inherit (import ./ci-lib.nix { pkgs = legacyPackagesUnstable; }) stripAttrsForHydra filterDerivations; |
169 | | - ci = import ./ci.nix { inherit (self.internal) compat; inherit system; }; |
170 | | - in stripAttrsForHydra (filterDerivations ci); |
171 | | - |
172 | | - requiredJobs = |
173 | | - let |
174 | | - inherit (legacyPackages) lib; |
175 | | - names = x: lib.filter (n: n != "recurseForDerivations" && n != "meta") |
176 | | - (builtins.attrNames x); |
177 | | - in |
178 | | - builtins.listToAttrs ( |
179 | | - lib.concatMap (nixpkgsVer: |
180 | | - let nixpkgsJobs = allJobs.${nixpkgsVer}; |
181 | | - in lib.concatMap (compiler-nix-name: |
182 | | - let ghcJobs = nixpkgsJobs.${compiler-nix-name}; |
183 | | - in builtins.map (crossPlatform: { |
184 | | - name = "required-${nixpkgsVer}-${compiler-nix-name}-${crossPlatform}"; |
185 | | - value = legacyPackages.releaseTools.aggregate { |
186 | | - name = "haskell.nix-${nixpkgsVer}-${compiler-nix-name}-${crossPlatform}"; |
187 | | - meta.description = "All ${nixpkgsVer} ${compiler-nix-name} ${crossPlatform} jobs"; |
188 | | - constituents = lib.collect lib.isDerivation ghcJobs.${crossPlatform}; |
189 | | - }; |
190 | | - }) (names ghcJobs) |
191 | | - ) (names nixpkgsJobs) |
192 | | - ) (names allJobs)); |
193 | | - |
194 | | - hydraJobs = allJobs; |
195 | | - |
196 | | - devShells = with self.legacyPackages.${system}; { |
197 | | - default = |
198 | | - mkShell { |
199 | | - buildInputs = [ |
200 | | - nixUnstable |
201 | | - cabal-install |
202 | | - haskell-nix.compiler.${compiler} |
203 | | - ]; |
204 | | - }; |
205 | | - } // __mapAttrs (compiler-nix-name: compiler: |
206 | | - mkShell { |
207 | | - buildInputs = [ |
208 | | - compiler |
209 | | - haskell-nix.cabal-install.${compiler-nix-name} |
210 | | - ]; |
211 | | - } |
212 | | - ) ( |
213 | | - # Exclude old versions of GHC to speed up `nix flake check` |
214 | | - builtins.removeAttrs haskell-nix.compiler |
215 | | - [ "ghc844" |
216 | | - "ghc861" "ghc862" "ghc863" "ghc864" |
217 | | - "ghc881" "ghc882" "ghc883" |
218 | | - "ghc8101" "ghc8102" "ghc8103" "ghc8104" "ghc8105" "ghc8106" "ghc810420210212" |
219 | | - "ghc901" |
220 | | - "ghc921" "ghc922" "ghc923"]); |
| 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 |
| 209 | + # Include hydraJobs from nix-tools subflake. |
| 210 | + # NOTE: These derivations do not depend on the haskell.nix in ./. but |
| 211 | + # on the version of haskell.nix locked in the subflake. They are |
| 212 | + # evaluated within their own flake and independently of anything |
| 213 | + # else. Here we only expose them in the main flake. |
| 214 | + // { nix-tools = nix-tools-hydraJobs.${system} or {}; }; |
| 215 | + |
| 216 | + devShells = with self.legacyPackages.${system}; { |
| 217 | + default = |
| 218 | + mkShell { |
| 219 | + buildInputs = [ |
| 220 | + nixUnstable |
| 221 | + cabal-install |
| 222 | + haskell-nix.compiler.${compiler} |
| 223 | + ]; |
| 224 | + }; |
| 225 | + } // __mapAttrs (compiler-nix-name: compiler: |
| 226 | + mkShell { |
| 227 | + buildInputs = [ |
| 228 | + compiler |
| 229 | + haskell-nix.cabal-install.${compiler-nix-name} |
| 230 | + ]; |
| 231 | + } |
| 232 | + ) ( |
| 233 | + # Exclude old versions of GHC to speed up `nix flake check` |
| 234 | + builtins.removeAttrs haskell-nix.compiler |
| 235 | + [ "ghc844" |
| 236 | + "ghc861" "ghc862" "ghc863" "ghc864" |
| 237 | + "ghc881" "ghc882" "ghc883" |
| 238 | + "ghc8101" "ghc8102" "ghc8103" "ghc8104" "ghc8105" "ghc8106" "ghc810420210212" |
| 239 | + "ghc901" |
| 240 | + "ghc921" "ghc922" "ghc923"]); |
221 | 241 | })); |
222 | 242 |
|
223 | 243 | # --- Flake Local Nix Configuration ---------------------------- |
|
0 commit comments