haskell.nix
haskell.nix copied to clipboard
Can't enable DWARF in modules, limiting the usefulness of it
There are two ways get a build with DWARF debugging built in right now
- Using
mypkg.components.library.dwarformypkg.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. - Adding something like this to the
projectmoduleslist 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.
I'd appreciate that, see https://github.com/input-output-hk/haskell.nix/issues/995
There is some logic for profiling which pushed that down, so you get profiling for dependencies as well. I think this could follow a similar pattern.
I'm currently using:
cachix-server =
let
# the playground uses ghc at runtime so it needs one packaged up with the dependencies it needs in one place
runtimeGhc = (cachixPkgs.shellFor {
additional = ps: [ ps.cachix-server ];
packages = _: [];
enableDWARF = true;
}).ghc;
in
pkgs.runCommand "cachix-server" { buildInputs = [ pkgs.makeWrapper ]; } ''
# We need to provide the ghc interpreter with the location of the ghc lib dir and the package db
mkdir -p $out
cp -R --no-preserve=mode,ownership ${cachixPkgs.cachix-server.components.exes.cachix-server}/* $out
chmod +x $out/bin/cachix-server
wrapProgram $out/bin/cachix-server \
--set GHC_LIB_DIR "${runtimeGhc}/lib/ghc-${runtimeGhc.version}" \
--set GHC_BIN_DIR "${runtimeGhc}/bin" \
--set GHC_PACKAGE_PATH "${runtimeGhc}/lib/ghc-${runtimeGhc.version}/package.conf.d"
'';
Hacky. The goal is to have cachix-server ghci command on the server, although that bit isn't really working well.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
so was this implemented?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.