[Nix-dev] Nix - building only some libraries with profiling
Peter Simons
simons at cryp.to
Sun Aug 9 16:55:26 CEST 2015
Hi Carlo,
> I need to transitively compile a package I'm working on with profiling. [...]
> How can I build with profiling only a few libraries?
profiledHaskellPackages = super.haskellPackages.override {
overrides = self: super: {
mkDerivation = drv: super.mkDerivation (drv // {enableLibraryProfiling = true;});
ghc-mod = self.callPackage /home/meditans/code/haskell/ghc-mod/default.nix {};
cabal-helper = self.callPackage /home/meditans/code/haskell/cabal-helper-0.3.4.0/default.nix {};
};
};
haskellPackages = super.haskellPackages.override {
overrides = self: super: {
inherit (self.profiledHaskellPackages) ghc-mod cabal-helper;
};
};
With these overrides configured, "haskellPackages" contains non-profiled
Haskell packages except "ghc-mod" and "cabal-helper", which have profiling
enabled (including in all their dependencies).
An alternative solution that might be simpler for a very small number of
packages is overrideScope:
haskellPackages = super.haskellPackages.override {
overrides = self: super: {
ghc-mod = (self.callPackage /home/meditans/code/haskell/ghc-mod {}).overrideScope (self: super: {
mkDerivation = drv: super.mkDerivation (drv // { enableLibraryProfiling = true; });
});
};
};
I hope this helps,
Peter
More information about the nix-dev
mailing list