@@ -122,11 +122,20 @@ main = bracket (return ()) (\() -> hFlush stdout >> hFlush stderr) $ \() -> do
122122
123123 shell :: Doc -> Doc
124124 shell expr = vcat
125− [ text "with (import <nixpkgs> {}).pkgs;"
126− , text "let pkg = " <> hang (text "haskellngPackages.callPackage") 2 (parens expr) <+> braces empty <> semi
127− , text "in"
128− , text " pkg.env"
129− ]
125+ [ text "{ nixpkgs ? import <nixpkgs> {}, compiler ? \"ghc7101\" }:"
126+ , text ""
127+ , text "let"
128+ , text ""
129+ , text " inherit (nixpkgs) pkgs;"
130+ , text ""
131+ , text " f = " <> expr <> semi
132+ , text ""
133+ , text " drv = pkgs.haskell.packages.${compiler}.callPackage f {};"
134+ , text ""
135+ , text "in"
136+ , text ""
137+ , text " if pkgs.lib.inNixShell then drv.env else drv"
138+ ]
130139
131140 deriv''' | optNixShellOutput cfg = shell deriv''
132141 | otherwise = deriv''