git.iko.soy/typeable/cabal2nix
on master help sign in
doc: move ghc-event override example into the miscellaneous section
1decba9Peter Simons
doc/user-guide.md+46−48
@@ -316,54 +316,6 @@ convert those automatically into build instructions for Nix using the
316`cabal2nix` utility, which you can install into your profile by running
316`cabal2nix` utility, which you can install into your profile by running
317`nix-env -i cabal2nix`.
317`nix-env -i cabal2nix`.
318
318
319−## How to override a cabal package version for a specific compiler version
320−
321−Say the default version of ghc-events is 0.4.4.0 and does not work with ghc784
322−We can override this by
323−
324− $ mkdir .nixpkgs/haskell/ && cd .nixpkgs/haskell/
325− $ cabal get ghc-events-0.4.3.0 && cd ghc-events-0.4.3.0 && cabal2nix --no-check ghc-events.cabal > default.nix
326−
327−in the config.nix we then override the packages
328−
329− #overrides for every compiler versions
330− myHaskellPackages = hp : hp.override {
331− overrides = self: super: with pkgs.haskell.lib; {
332− ...
333− };
334− };
335− myHaskellPackages784 = hp : hp.override {
336− overrides = self: super: with pkgs.haskell.lib; {
337− ...
338− ghc-events = dontCheck (pkgs.haskell.packages.ghc784.callPackage ./haskell/ghc-events-0.4.3.0 {});
339− ...
340− };
341− };
342− haskellngPackages = myHaskellPackages super.haskellPackages;
343− haskell784Packages = myHaskellPackages784(myHaskellPackages super.haskell.packages.ghc784);
344−
345−We can then use those packages to build environments which will pick up the desired version
346−
347− hs784 = haskell784Packages.ghcWithPackages (p: with p;
348− [
349− ghc-events
350− ...
351− ]
352− );
353−
354− hs7101 = haskellngPackages.ghcWithPackages (p: with p;
355− [
356− ghc-events
357− ...
358− ]
359−
360−as can be verified by
361−
362− nix-store -qR $(nix-instantiate '<nixpkgs>' -A pkgs.hs784 ) | grep ghc-events
363− nix-store -qR $(nix-instantiate '<nixpkgs>' -A pkgs.hs7101) | grep ghc-events
364−
365−
366−
367## How to build a stand-alone project
319## How to build a stand-alone project
368
320
369For example, let's assume that you're working on a private project called
321For example, let's assume that you're working on a private project called
@@ -479,6 +431,52 @@ following snippet in your `~/.nixpkgs/config.nix` file:
479 };
431 };
480 }
432 }
481
433
434+## How to override a cabal package version for a specific compiler version
435+
436+Say the default version of ghc-events is 0.4.4.0 and does not work with ghc784
437+We can override this by
438+
439+ $ mkdir .nixpkgs/haskell/ && cd .nixpkgs/haskell/
440+ $ cabal get ghc-events-0.4.3.0 && cd ghc-events-0.4.3.0 && cabal2nix --no-check ghc-events.cabal > default.nix
441+
442+in the config.nix we then override the packages
443+
444+ #overrides for every compiler versions
445+ myHaskellPackages = hp : hp.override {
446+ overrides = self: super: with pkgs.haskell.lib; {
447+ ...
448+ };
449+ };
450+ myHaskellPackages784 = hp : hp.override {
451+ overrides = self: super: with pkgs.haskell.lib; {
452+ ...
453+ ghc-events = dontCheck (pkgs.haskell.packages.ghc784.callPackage ./haskell/ghc-events-0.4.3.0 {});
454+ ...
455+ };
456+ };
457+ haskellngPackages = myHaskellPackages super.haskellPackages;
458+ haskell784Packages = myHaskellPackages784(myHaskellPackages super.haskell.packages.ghc784);
459+
460+We can then use those packages to build environments which will pick up the desired version
461+
462+ hs784 = haskell784Packages.ghcWithPackages (p: with p;
463+ [
464+ ghc-events
465+ ...
466+ ]
467+ );
468+
469+ hs7101 = haskellngPackages.ghcWithPackages (p: with p;
470+ [
471+ ghc-events
472+ ...
473+ ]
474+
475+as can be verified by
476+
477+ nix-store -qR $(nix-instantiate '<nixpkgs>' -A pkgs.hs784 ) | grep ghc-events
478+ nix-store -qR $(nix-instantiate '<nixpkgs>' -A pkgs.hs7101) | grep ghc-events
479+
482## How to recover from GHC's infamous non-deterministic library ID bug
480## How to recover from GHC's infamous non-deterministic library ID bug
483
481
484GHC and distributed build farms don't get along well:
482GHC and distributed build farms don't get along well: