Skip to content

Commit

Permalink
merge origin/main
Browse files Browse the repository at this point in the history
  • Loading branch information
seanhess committed Dec 24, 2024
2 parents bcb83eb + 4a82933 commit 7579dda
Showing 1 changed file with 37 additions and 46 deletions.
83 changes: 37 additions & 46 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -87,25 +87,18 @@
inherit system;
};

pkgsOverlayed = import inputs.nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
ghcPkgs =
(import inputs.nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
}).haskell.packages;

# Define GHC versions list
ghcVersions = [
"966"
"982"
];

# Create an attrset of GHC packages
ghcPkgs = builtins.listToAttrs (
map (version: {
name = "ghc${version}";
value = pkgsOverlayed.haskell.packages."ghc${version}";
}) ghcVersions
);

example-src = nix-filter.lib {
root = ./example;
include = [
Expand All @@ -116,8 +109,23 @@
];
};

pre-commit = git-hooks.lib.${system}.run {
src = src;
hooks = {
hlint.enable = true;
fourmolu.enable = true;
hpack.enable = true;
nixfmt-rfc-style.enable = true;
flake-checker = {
enable = true;
args = [ "--no-telemetry" ];
};
check-merge-conflicts.enable = true;
};
};

shellCommon = version: {
inherit (self.checks.${system}.pre-commit-check) shellHook;
inherit (pre-commit) shellHook;
buildInputs = with pkgs.haskell.packages."ghc${version}"; [
cabal-install
haskell-language-server
Expand All @@ -143,39 +151,22 @@
version: pkgs.haskell.lib.justStaticExecutables self.packages.${system}."ghc${version}-example";
in
{
checks =
{
pre-commit-check = git-hooks.lib.${system}.run {
src = src;
hooks = {
# hlint.enable = true;
# fourmolu.enable = true;
hpack.enable = true;
nixfmt-rfc-style.enable = true;
flake-checker = {
enable = true;
args = [ "--no-telemetry" ];
};
check-merge-conflicts.enable = true;
};
};
}
// (builtins.listToAttrs (
builtins.concatMap (version: [
{
name = "ghc${version}-check-${packageName}";
value = pkgs.runCommand "ghc${version}-check-${packageName}" {
buildInputs = [ self.packages.${system}."ghc${version}-${packageName}" ];
} "touch $out";
}
{
name = "ghc${version}-check-example";
value = pkgs.runCommand "ghc${version}-check-example" {
buildInputs = [ (examples-exe version) ];
} "type example; touch $out";
}
]) ghcVersions
));
checks = builtins.listToAttrs (
builtins.concatMap (version: [
{
name = "ghc${version}-check-${packageName}";
value = pkgs.runCommand "ghc${version}-check-${packageName}" {
buildInputs = [ self.packages.${system}."ghc${version}-${packageName}" ];
} "touch $out";
}
{
name = "ghc${version}-check-example";
value = pkgs.runCommand "ghc${version}-check-example" {
buildInputs = [ (examples-exe version) ];
} "type example; touch $out";
}
]) ghcVersions
);

apps =
{
Expand Down

0 comments on commit 7579dda

Please sign in to comment.