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

_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to