Skip to content

Commit

Permalink
Update compilers
Browse files Browse the repository at this point in the history
  • Loading branch information
tfc committed Oct 25, 2023
1 parent 4d57769 commit 835d7a8
Showing 1 changed file with 32 additions and 19 deletions.
51 changes: 32 additions & 19 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,42 @@
hardeningDisable = [ "all" ];
};

packages.default = config.packages.attoparsec;
packages.attoparsec = pkgs.callPackage ./build.nix { };
packages =
let
attoparsec = pkgs.callPackage ./build.nix { };
in
{
default = config.packages.attoparsec;
attoparsec =
if pkgs.stdenv.hostPlatform.isDarwin
then config.packages.attoparsec-clang
else config.packages.attoparsec-gcc;

packages.coverage = config.packages.attoparsec.overrideAttrs (_: {
hardeningDisable = [ "all" ];
cmakeBuildType = "Coverage";
postCheck = ''
cmake --build . --target process_coverage
'';
installPhase = ''
cp -r coverage $out
'';
});
attoparsec-gcc = attoparsec.override {
stdenv = pkgs.gcc13Stdenv;
};

attoparsec-clang = attoparsec.override {
stdenv = pkgs.clang16Stdenv;
clang-tools = pkgs.clang-tools_16;
};

coverage = config.packages.attoparsec.overrideAttrs (_: {
hardeningDisable = [ "all" ];
cmakeBuildType = "Coverage";
postCheck = ''
cmake --build . --target process_coverage
'';
installPhase = ''
cp -r coverage $out
'';
});
};

checks = {
inherit (config.packages)
coverage
attoparsec-clang
;

pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
Expand All @@ -44,10 +63,6 @@
statix.enable = true;
};
};

clang = config.packages.attoparsec.override {
stdenv = pkgs.clang16Stdenv;
};
} // pkgs.lib.optionalAttrs (!pkgs.hostPlatform.isDarwin) (
# Sanitizers turned out to be complicated on macOS for now.
let
Expand All @@ -67,9 +82,7 @@
sanitizer-leak = [ "leak" ];
}
) // pkgs.lib.optionalAttrs (!pkgs.hostPlatform.isDarwin) {
gcc = config.packages.attoparsec.override {
stdenv = pkgs.gccStdenv;
};
inherit (config.packages) attoparsec-gcc;
};
};
};
Expand Down

0 comments on commit 835d7a8

Please sign in to comment.