Skip to content

Commit

Permalink
Use short names and refactor a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishmack committed Oct 16, 2023
1 parent 700e742 commit 14a1d3c
Showing 1 changed file with 73 additions and 71 deletions.
144 changes: 73 additions & 71 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -72,89 +72,91 @@
# Map the compiler-nix-name to a final compiler-nix-name the way haskell.nix
# projects do (that way we can use short names)
let compilers = pkgs: pkgs.lib.genAttrs [
"ghc8107"
"ghc902"
"ghc928"
"ghc947"
"ghc963"
"ghc981"
"ghc99"] (compiler-nix-name:
pkgs.haskell-nix.compiler.${
(pkgs.haskell-nix.cabalProject' { inherit compiler-nix-name; }).args.compiler-nix-name});
"ghc810"
"ghc90"
"ghc92"
"ghc94"
"ghc96"
"ghc98"
"ghc99"] (short-name: rec {
inherit pkgs self toolsModule;
compiler-nix-name = pkgs.haskell-nix.resolve-compiler-name short-name;
compiler = pkgs.buildPackages.haskell-nix.compiler.${compiler-nix-name};
});
js-compilers = pkgs: builtins.removeAttrs (compilers pkgs)
[
"ghc902"
"ghc928"
"ghc947"
"ghc90"
"ghc92"
"ghc94"
];
windows-compilers = pkgs:
pkgs.lib.optionalAttrs (__elem system ["x86_64-linux"])
(builtins.removeAttrs (compilers pkgs)
[
]);
in (builtins.mapAttrs (compiler-nix-name: compiler:
import ./dynamic.nix { inherit pkgs self compiler compiler-nix-name toolsModule; withIOG = false; }
in (builtins.mapAttrs (short-name: args:
import ./dynamic.nix (args // { withIOG = false; })
) (compilers pkgs)
// pkgs.lib.mapAttrs' (compiler-nix-name: compiler:
pkgs.lib.nameValuePair "${compiler-nix-name}-minimal" (
import ./dynamic.nix { inherit pkgs self compiler compiler-nix-name toolsModule; withHLS = false; withHlint = false; withIOG = false; }
// pkgs.lib.mapAttrs' (short-name: args:
pkgs.lib.nameValuePair "${short-name}-minimal" (
import ./dynamic.nix (args // { withHLS = false; withHlint = false; withIOG = false; })
)) (compilers pkgs)
// pkgs.lib.mapAttrs' (compiler-nix-name: compiler:
pkgs.lib.nameValuePair "${compiler-nix-name}-static" (
import ./static.nix { pkgs = static-pkgs; inherit self compiler compiler-nix-name toolsModule; withIOG = false; }
)) (compilers static-pkgs.buildPackages)
// pkgs.lib.mapAttrs' (compiler-nix-name: compiler:
pkgs.lib.nameValuePair "${compiler-nix-name}-static-minimal" (
import ./static.nix { pkgs = static-pkgs; inherit self compiler compiler-nix-name toolsModule; withHLS = false; withHlint = false; withIOG = false; }
)) (compilers static-pkgs.buildPackages)
// pkgs.lib.mapAttrs' (compiler-nix-name: compiler:
pkgs.lib.nameValuePair "${compiler-nix-name}-js" (
import ./cross-js.nix { pkgs = js-pkgs.buildPackages; inherit self compiler compiler-nix-name toolsModule; }
)) (js-compilers js-pkgs.buildPackages)
// pkgs.lib.mapAttrs' (compiler-nix-name: compiler:
pkgs.lib.nameValuePair "${compiler-nix-name}-js-minimal" (
import ./cross-js.nix { pkgs = js-pkgs.buildPackages; inherit self compiler compiler-nix-name toolsModule; withHLS = false; withHlint = false; }
)) (js-compilers js-pkgs.buildPackages)
// pkgs.lib.mapAttrs' (compiler-nix-name: compiler:
pkgs.lib.nameValuePair "${compiler-nix-name}-windows" (
import ./cross-windows.nix { pkgs = windows-pkgs; inherit self compiler compiler-nix-name; }
)) (windows-compilers windows-pkgs.buildPackages)
// pkgs.lib.mapAttrs' (compiler-nix-name: compiler:
pkgs.lib.nameValuePair "${compiler-nix-name}-windows-minimal" (
import ./cross-windows.nix { pkgs = windows-pkgs; inherit self compiler compiler-nix-name; withHLS = false; withHlint = false; }
)) (windows-compilers windows-pkgs.buildPackages)
// pkgs.lib.mapAttrs' (compiler-nix-name: compiler:
pkgs.lib.nameValuePair "${compiler-nix-name}-iog" (
import ./dynamic.nix { inherit pkgs self compiler compiler-nix-name toolsModule; withIOG = true; }
// pkgs.lib.mapAttrs' (short-name: args:
pkgs.lib.nameValuePair "${short-name}-static" (
import ./static.nix (args // { withIOG = false; })
)) (compilers static-pkgs)
// pkgs.lib.mapAttrs' (short-name: args:
pkgs.lib.nameValuePair "${short-name}-static-minimal" (
import ./static.nix (args // { withHLS = false; withHlint = false; withIOG = false; })
)) (compilers static-pkgs)
// pkgs.lib.mapAttrs' (short-name: args:
pkgs.lib.nameValuePair "${short-name}-js" (
import ./cross-js.nix (args // { pkgs = js-pkgs.pkgsBuildBuild; })
)) (js-compilers js-pkgs)
// pkgs.lib.mapAttrs' (short-name: args:
pkgs.lib.nameValuePair "${short-name}-js-minimal" (
import ./cross-js.nix (args // { pkgs = js-pkgs.buildPackages; withHLS = false; withHlint = false; })
)) (js-compilers js-pkgs)
// pkgs.lib.mapAttrs' (short-name: args:
pkgs.lib.nameValuePair "${short-name}-windows" (
import ./cross-windows.nix args
)) (windows-compilers windows-pkgs)
// pkgs.lib.mapAttrs' (short-name: args:
pkgs.lib.nameValuePair "${short-name}-windows-minimal" (
import ./cross-windows.nix (args // { withHLS = false; withHlint = false; })
)) (windows-compilers windows-pkgs)
// pkgs.lib.mapAttrs' (short-name: args:
pkgs.lib.nameValuePair "${short-name}-iog" (
import ./dynamic.nix (args // { withIOG = true; })
)) (compilers pkgs)
// pkgs.lib.mapAttrs' (compiler-nix-name: compiler:
pkgs.lib.nameValuePair "${compiler-nix-name}-minimal-iog" (
import ./dynamic.nix { inherit pkgs self compiler compiler-nix-name toolsModule; withHLS = false; withHlint = false; withIOG = true; }
// pkgs.lib.mapAttrs' (short-name: args:
pkgs.lib.nameValuePair "${short-name}-minimal-iog" (
import ./dynamic.nix (args // { withHLS = false; withHlint = false; withIOG = true; })
)) (compilers pkgs)
// pkgs.lib.mapAttrs' (compiler-nix-name: compiler:
pkgs.lib.nameValuePair "${compiler-nix-name}-static-iog" (
import ./static.nix { pkgs = static-pkgs; inherit self compiler compiler-nix-name toolsModule; withIOG = true; }
)) (compilers static-pkgs.buildPackages)
// pkgs.lib.mapAttrs' (compiler-nix-name: compiler:
pkgs.lib.nameValuePair "${compiler-nix-name}-static-minimal-iog" (
import ./static.nix { pkgs = static-pkgs; inherit self compiler compiler-nix-name toolsModule; withHLS = false; withHlint = false; withIOG = true; }
)) (compilers static-pkgs.buildPackages)
// pkgs.lib.mapAttrs' (compiler-nix-name: compiler:
pkgs.lib.nameValuePair "${compiler-nix-name}-js-iog" (
import ./cross-js.nix { pkgs = js-pkgs.buildPackages; inherit self compiler compiler-nix-name toolsModule; withIOG = true; }
)) (js-compilers js-pkgs.buildPackages)
// pkgs.lib.mapAttrs' (compiler-nix-name: compiler:
pkgs.lib.nameValuePair "${compiler-nix-name}-js-minimal-iog" (
import ./cross-js.nix { pkgs = js-pkgs.buildPackages; inherit self compiler compiler-nix-name toolsModule; withHLS = false; withHlint = false; withIOG = true; }
)) (js-compilers js-pkgs.buildPackages)
// pkgs.lib.mapAttrs' (compiler-nix-name: compiler:
pkgs.lib.nameValuePair "${compiler-nix-name}-windows-iog" (
import ./cross-windows.nix { pkgs = windows-pkgs; inherit self compiler compiler-nix-name; withIOG = true; }
)) (windows-compilers windows-pkgs.buildPackages)
// pkgs.lib.mapAttrs' (compiler-nix-name: compiler:
pkgs.lib.nameValuePair "${compiler-nix-name}-windows-minimal-iog" (
import ./cross-windows.nix { pkgs = windows-pkgs; inherit self compiler compiler-nix-name; withHLS = false; withHlint = false; withIOG = true; }
)) (windows-compilers windows-pkgs.buildPackages)
// pkgs.lib.mapAttrs' (short-name: args:
pkgs.lib.nameValuePair "${short-name}-static-iog" (
import ./static.nix (args // { withIOG = true; })
)) (compilers static-pkgs)
// pkgs.lib.mapAttrs' (short-name: args:
pkgs.lib.nameValuePair "${short-name}-static-minimal-iog" (
import ./static.nix (args // { withHLS = false; withHlint = false; withIOG = true; })
)) (compilers static-pkgs)
// pkgs.lib.mapAttrs' (short-name: args:
pkgs.lib.nameValuePair "${short-name}-js-iog" (
import ./cross-js.nix (args // { pkgs = js-pkgs.buildPackages; withIOG = true; })
)) (js-compilers js-pkgs)
// pkgs.lib.mapAttrs' (short-name: args:
pkgs.lib.nameValuePair "${short-name}-js-minimal-iog" (
import ./cross-js.nix (args // { pkgs = js-pkgs.buildPackages; withHLS = false; withHlint = false; withIOG = true; })
)) (js-compilers js-pkgs)
// pkgs.lib.mapAttrs' (short-name: args:
pkgs.lib.nameValuePair "${short-name}-windows-iog" (
import ./cross-windows.nix (args // { withIOG = true; })
)) (windows-compilers windows-pkgs)
// pkgs.lib.mapAttrs' (short-name: args:
pkgs.lib.nameValuePair "${short-name}-windows-minimal-iog" (
import ./cross-windows.nix (args // { withHLS = false; withHlint = false; withIOG = true; })
)) (windows-compilers windows-pkgs)
);
devShells = devShellsWithToolsModule {};
# Eval must be done on linux when we use hydra to build environment
Expand Down

0 comments on commit 14a1d3c

Please sign in to comment.