Created
May 3, 2021 11:15
-
-
Save SCOTT-HAMILTON/71106840b28087cd24e2f7e6aae9c85f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs ? import <nixpkgs-unstable> {} }: | |
let | |
buildInstrumentedAdapter = stdenv: | |
let | |
flags = "-fprofile-instr-generate -fcoverage-mapping"; | |
in | |
stdenv // | |
{ mkDerivation = args: stdenv.mkDerivation (args // { | |
NIX_CFLAGS_COMPILE = toString (args.NIX_CFLAGS_COMPILE or "") + " " + flags; | |
NIX_LDFLAGS_COMPILE = toString (args.NIX_CFLAGS_COMPILE or "") + " " + flags; | |
}); | |
}; | |
enableInstrumented = pkg: | |
let | |
clangStdenv = pkgs.overrideCC pkgs.llvmPackages_11.stdenv pkgs.clang; | |
in | |
pkg.override { | |
stdenv = buildInstrumentedAdapter clangStdenv; | |
}; | |
in | |
enableInstrumented pkgs.xlibs.libX11 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment