[Nix-dev] lens 4 transition plan?

Oliver Charles ollie at ocharles.org.uk
Wed Feb 19 13:19:07 CET 2014


Gergely Risko <gergely at risko.hu> writes:

> Hi,
>
> Peter: I saw that you started to upgrade stuff to lens 4, e.g. linear
> 1.6 requires it and in nixpkgs lens is now correctly overridden to
> version 4 for that package.
>
> However I wanted to ask for your transition plan/timeframe regarding
> this change?  Do you plan to switch over to lens4 as default sometime
> and provide overrides for the not forward compatible packages?
>
> Should we provide patches in nixpkgs where needed to upgrade everything
> to lens4 until they're fixed upstream?
>
> Asking this, because having both lens3 and lens4 can cause some
> instances to be provided multiple times and that causes some pain.  I
> just ignored linear for now in my system, but I really would like to
> minimize the timespan of the situation where half my packages depend on
> lens3 and the other half on lens4. :)

At work, we override `haskellPackages` to have lens 4 and aeson 0.7. We
have dev.nix files in each project, as such:



with import <nixpkgs> {};
let haskellPackages = pkgs.haskellPackages_ghc763_profiling.override {
      extraPrefs = self: {
        aeson = self.aeson_0_7_0_1;
        lens = self.lens_4_0_3;
        fynder = self.callPackage ../fynder {};
        snapletSocketIO = self.callPackage ../../snaplet-socketio {};
        snapCors = self.callPackage ../../snap-cors {};
        tempo = self.callPackage ../tempo {};
        metronome = self.callPackage ./. {};
        fb = lib.overrideDerivation self.fb (attrs: {
          patches = [ /home/ollie/nixpkgs/pkgs/development/libraries/haskell/fb/21.diff ];
        });
      };
    };
in lib.overrideDerivation haskellPackages.metronome (attrs: {
     buildInputs = [ haskellPackages.cabalInstall_1_18_0_2 ] ++ attrs.buildInputs;
   })



As you can see, this project (metronome) requires aeson 0.7, lens 4, and
a few other things that aren't on Hackage yet. The project has a
default.nix like this:



{ cabal
, aeson, errors, extensibleEffects, IntervalMap, digestiveFunctorsAeson, time
, postgresqlSimple, pipesParse, iCalendar, lens, fynder, snap, snapletSocketIO
, snapCors, webRoutesBoomerang, jsonAssertions, HTTP, indexed
, quickcheckInstances, tasty, tastyRerun, tastyAntXml, tastyHunit
, tastyQuickcheck, tastySmallcheck, httpClient, pipes, pipesConcurrency, hlint
}:
cabal.mkDerivation (self: {
  pname = "metronome";
  version = "0.1.0";
  src = ./.;
  buildDepends = [
    aeson errors extensibleEffects IntervalMap digestiveFunctorsAeson
    time postgresqlSimple pipesParse iCalendar lens
    fynder
    snap
    snapletSocketIO snapCors
    webRoutesBoomerang
  ];
  testDepends = [
    jsonAssertions
    lens HTTP
    indexed quickcheckInstances tasty tastyAntXml
    tastyHunit tastyQuickcheck tastySmallcheck httpClient
    pipes pipesConcurrency tastyRerun hlint
  ];
})



This has ensured we get consistent aeson and lens instances until the
defaults get switched over. That said, I'd still be interested to know
when we plan to do that, so I can keep close to <nixpkgs>.

Hope this helps,
- ocharles


More information about the nix-dev mailing list