polysemy/flake.nix

58 lines
1.6 KiB
Nix
Raw Normal View History

2021-01-25 01:37:04 +03:00
{
description = "Higher-order, low-boilerplate free monads.";
inputs = {
2024-07-08 00:56:23 +03:00
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
2023-09-01 02:23:33 +03:00
flake-utils.url = "github:numtide/flake-utils";
2021-01-25 01:37:04 +03:00
};
2023-09-01 02:23:33 +03:00
outputs = {nixpkgs, flake-utils, ...}:
2021-01-25 01:37:04 +03:00
flake-utils.lib.eachSystem ["x86_64-linux"] (system:
2023-09-01 02:23:33 +03:00
with nixpkgs.lib;
2021-01-25 01:37:04 +03:00
let
hsPkgs = nixpkgs: compiler: import ./nix/overlay.nix { inherit system nixpkgs compiler; };
2021-01-25 01:37:04 +03:00
2021-11-21 02:50:56 +03:00
ghcs = {
2023-09-01 02:23:33 +03:00
"90" = hsPkgs nixpkgs "ghc90";
"92" = hsPkgs nixpkgs "ghc92";
"94" = hsPkgs nixpkgs "ghc94";
"96" = hsPkgs nixpkgs "ghc96";
2023-12-29 02:24:38 +03:00
"98" = hsPkgs nixpkgs "ghc98";
2024-07-08 00:56:23 +03:00
"910" = hsPkgs nixpkgs "ghc910";
2021-11-21 02:50:56 +03:00
};
2023-12-29 02:24:38 +03:00
default = "96";
2021-11-21 02:50:56 +03:00
mkPackages = version: {
"polysemy-${version}" = ghcs.${version}.polysemy;
"polysemy-plugin-${version}" = ghcs.${version}.polysemy-plugin;
2021-01-25 01:37:04 +03:00
};
2022-09-28 20:41:06 +03:00
defaultPackages = {
2023-12-29 02:24:38 +03:00
inherit (ghcs.${default}) polysemy polysemy-plugin;
default = ghcs.${default}.polysemy;
2022-09-28 20:41:06 +03:00
};
packages = foldl' (l: r: l // r) defaultPackages (map mkPackages (attrNames ghcs));
2021-01-25 01:37:04 +03:00
2023-04-06 21:22:42 +03:00
mkDevShell = name: ghc: ghc.shellFor {
2021-11-21 02:50:56 +03:00
packages = p: [p.polysemy p.polysemy-plugin];
buildInputs = with ghc; [
2021-01-25 01:37:04 +03:00
cabal-install
2024-07-08 00:56:23 +03:00
] ++ nixpkgs.lib.optionals (name != "910" && name != "98" && name != "90") [
(ghc.pkgs.haskell.lib.dontCheck ghcid)
haskell-language-server
];
2021-01-25 01:37:04 +03:00
};
2023-04-06 21:22:42 +03:00
devShells = mapAttrs' (n: g: nameValuePair "ghc${n}" (mkDevShell n g)) ghcs;
2021-11-21 02:50:56 +03:00
in {
2022-09-28 20:41:06 +03:00
inherit packages;
2021-11-21 02:50:56 +03:00
2023-12-29 02:24:38 +03:00
devShells = devShells // { default = devShells."ghc${default}"; };
2021-11-21 02:50:56 +03:00
checks = packages;
2021-01-25 01:37:04 +03:00
});
}