[Nix-dev] A Journey into our brand-new Haskell infrastructure: Part II
Richard Wallace
rwallace at thewallacepack.net
Fri Jan 16 19:03:57 CET 2015
I feel like I must be missing something, because everytime I try and
override a package with ghcWithPackages, it ends up rebuilding every
Haskell library. For instance, I have this shell.nix <
https://gist.github.com/purefn/026625ad116b05ff9a8d>.
In this case, I've overridden the AesonBson package with a specific
commit. In other cases, I might want to add an additional package, such as
in this response on SO <
https://stackoverflow.com/questions/27968909/how-to-get-cabal-and-nix-work-together/27970684#27970684
>.
In both scenarios, instead of just building the newly included or modified
libraries, every package gets rebuilt. Is there a way to accomplish the
same thing and avoid the long rebuild cycles?
Thanks,
Rich
On Tue, Jan 13, 2015 at 4:50 AM, Peter Simons <simons at cryp.to> wrote:
> Hi Thomas,
>
> > How can I override a package to enable profiling?
>
> commit [1] adds helper functions that allow referring to any package "foo"
> as "enableLibraryProfiling foo" to get a variant that supports profiling.
>
> If you want to enable profiling for *all* packages, then you can replace
> the 'mkDerivation' function with one that enables the feature by default,
> i.e. by adding the snippet
>
> | haskellPackageOverrides = self: super: {
> | mkDerivation = expr: super.mkDerivation (expr // {
> enableLibraryProfiling = true; });
> | };
>
> to your ~/.nixpkgs/config.nix file.
>
>
> > Is there an obvious way in general to apply the same override to a
> > package and all its dependencies?
>
> No, we can't do that yet. But we can do something else, that's almost
> equally goos: we can modify the package set in which a package (and all
> its dependencies) are evaluated. Just add
>
> | {
> | packageOverrides = super: let self = super.pkgs; in
> | {
> | foo = self.haskellngPackages.foo.overrideScope (self: super: {
> | mkDerivation = expr: super.mkDerivation (expr // {
> enableLibraryProfiling = true; });
> | });
> | }
> | }
>
> to your ~/.nixpkgs/config.nix to get a variant of "foo" that has profiling
> enabled in all its dependencies as well. If you take that stuff to the
> extreme, then it looks like [2].
>
> I hope this helps,
> Peter
>
> [1]
> https://github.com/NixOS/nixpkgs/commit/e4a68f0b98c28319913a4f2104ddb0524262f390
> [2]
> https://github.com/NixOS/nixpkgs/blob/9e114ccd2693daab6bca3c05674c549884097925/pkgs/development/haskell-modules/configuration-ghc-7.8.x.nix#L43-87
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20150116/b3333f33/attachment.html
More information about the nix-dev
mailing list