haskell.nix icon indicating copy to clipboard operation
haskell.nix copied to clipboard

Can't enable DWARF in modules, limiting the usefulness of it

Open purefn opened this issue 3 years ago • 6 comments

There are two ways get a build with DWARF debugging built in right now

  1. Using mypkg.components.library.dwarf or mypkg.components.exes.myexe.dwarf. This is of limited use because there is no way to turn enable building with DWARF debug info built into all the libraries your library or exe depend on.
  2. Adding something like this to the project modules list to enable it for all components
({ pkgs, ...}: {
  ghcOptions = optional (pkgs.stdenv.hostPlatform.isLinux && !pkgs.haskell-nix.haskellLib.isCrossHost && !pkgs.stdenv.hostPlatform.isMusl) "-g3";
})

Which works fine, but reproduces the checking logic that already exists in comp-builder.nix.

Is there any reason not to add enableDWARF as a component/packge/global parameter, so the above example, to enable it everywhere, would simply become

{
  enableDWARF = true;
}

That way we wouldn't have to worry about checking all the same things that are checked in comp-builder.nix.

Happy to open a PR for this if it is something people would want.

purefn avatar May 27 '21 19:05 purefn