git.iko.soy/typeable/cabal2nix
on master help sign in
cabal2nix --shell output uses "haskellPackages" when no "compiler" argument is specified.

The generated shell.nix file accepts a string argument called "compiler" that determines the package set used to instantiate the generated expression. For example, running "nix-shell --argstr compiler ghc7102" would evaluate the build inside of "pkgs.haskell.packages.ghc7102". Earlier versions of cabal2nix had the current default compiler hard-coded in the expression, but after this change this is no longer the case. When "compiler" remains unspecified, it defaults to "default", and this value causes evaluation in "pkgs.haskellPackages", which is the package set most people would like to use by default. That change has to benefits: 1) Generated expression no longer contain any particular compiler version. The choice of the default compiler depends on the version of Nixpkgs that's used to build the expression. 2) When the default compiler is used, overrides configured for the default package set apply, which was not the case in earlier versions. This resolves https://github.com/NixOS/cabal2nix/issues/186.

commit9f589961fba9fa6a92900c37cf1ab16c597b0c69 authorPeter Simons <simons@cryp.to> dateFri 7 Aug 2015, 22:13 (11 years ago) parent2b9cf46
1 file changed+6−2
src/cabal2nix.hs+6−2
src/cabal2nix.hs+6−2
@@ -102,7 +102,7 @@ main = bracket (return ()) (\() -> hFlush stdout >> hFlush stderr) $ \() -> do
102102
103103 shell :: Doc
104104 shell = vcat
105− [ text "{ nixpkgs ? import <nixpkgs> {}, compiler ? \"ghc7101\" }:"
105+ [ text "{ nixpkgs ? import <nixpkgs> {}, compiler ? \"default\" }:"
106106 , text ""
107107 , text "let"
108108 , text ""
@@ -110,7 +110,11 @@ main = bracket (return ()) (\() -> hFlush stdout >> hFlush stderr) $ \() -> do
110110 , text ""
111111 , hcat [ text " f = ", deriv', semi ]
112112 , text ""
113− , text " drv = pkgs.haskell.packages.${compiler}.callPackage f {};"
113+ , text " haskellPackages = if compiler == \"default\""
114+ , text " then pkgs.haskellPackages"
115+ , text " else pkgs.haskell.packages.${compiler};"
116+ , text ""
117+ , text " drv = haskellPackages.callPackage f {};"
114118 , text ""
115119 , text "in"
116120 , text ""