Skip to content

Commit 869ee38

Browse files
committed
Refactor devShells
1 parent 2db2f5e commit 869ee38

File tree

1 file changed

+38
-43
lines changed

1 file changed

+38
-43
lines changed

flake.nix

Lines changed: 38 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -263,53 +263,48 @@
263263
);
264264

265265
devShells = forEachSystemPkgs (pkgs:
266-
let inherit (pkgs) mkShell nixVersions cabal-install haskell-nix;
267-
in {
268-
default =
269-
mkShell {
266+
let
267+
mkHaskellNixShell = compiler-nix-name:
268+
pkgs.mkShell {
270269
buildInputs = [
271-
nixVersions.latest
272-
cabal-install
273-
haskell-nix.compiler.${compiler}
270+
pkgs.nixVersions.latest
271+
pkgs.haskell-nix.cabal-install.${compiler-nix-name}
272+
pkgs.haskell-nix.compiler.${compiler-nix-name}
274273
];
275274
};
276-
}
277-
//
278-
builtins.mapAttrs
279-
(compiler-nix-name: compiler:
280-
mkShell {
281-
buildInputs = [
282-
compiler
283-
haskell-nix.cabal-install.${compiler-nix-name}
284-
];
285-
})
286-
(
287-
# Exclude old versions of GHC to speed up `nix flake check`
288-
builtins.removeAttrs haskell-nix.compiler
289-
[
290-
"ghc844"
291-
"ghc861"
292-
"ghc862"
293-
"ghc863"
294-
"ghc864"
295-
"ghc881"
296-
"ghc882"
297-
"ghc883"
298-
"ghc8101"
299-
"ghc8102"
300-
"ghc8103"
301-
"ghc8104"
302-
"ghc8105"
303-
"ghc8106"
304-
"ghc810420210212"
305-
"ghc901"
306-
"ghc921"
307-
"ghc922"
308-
"ghc923"
309-
]
310-
)
311-
);
275+
shells = lib.genAttrs
276+
(
277+
# Exclude old versions of GHC to speed up `nix flake check`
278+
lib.attrNames (
279+
lib.removeAttrs pkgs.haskell-nix.compiler
280+
[
281+
"ghc844"
282+
"ghc861"
283+
"ghc862"
284+
"ghc863"
285+
"ghc864"
286+
"ghc881"
287+
"ghc882"
288+
"ghc883"
289+
"ghc8101"
290+
"ghc8102"
291+
"ghc8103"
292+
"ghc8104"
293+
"ghc8105"
294+
"ghc8106"
295+
"ghc810420210212"
296+
"ghc901"
297+
"ghc921"
298+
"ghc922"
299+
"ghc923"
300+
]
301+
)
302+
)
303+
mkHaskellNixShell;
304+
in
305+
shells // { default = shells.${compiler}; });
312306
};
307+
313308
in
314309
with (import nixpkgs { system = "x86_64-linux"; });
315310
traceHydraJobs (lib.recursiveUpdate flake (lib.optionalAttrs (ifdLevel > 2) {

0 commit comments

Comments
 (0)