diff --git a/scripts/README.md b/scripts/README.md
index aee3b2876d89b511d6350b76c144f82eb2cb7339..949dbab1d3e6d4df71e35b3b9d4bc6989bc6e075 100644
--- a/scripts/README.md
+++ b/scripts/README.md
@@ -26,7 +26,7 @@ self: super:
   ghcHEAD = super.haskell.packages.ghcHEAD.override
   { overrides = sel: sup:
                   # The patches from the directory
-                  ((super.callPackage self.patches {} sel sup)
+                  ((super.callPackage self.patches { haskellLib = haskell.lib.compose; } sel sup)
                   # Any more local overrides you want.
                   // { mkDerivation = drv: sup.mkDerivation
                         ( drv // { jailbreak = true; doHaddock = false; });
diff --git a/scripts/generate-nix-overrides.hs b/scripts/generate-nix-overrides.hs
index 4c8260553b824fb55be60dc4915c522390901b10..ce36b5ae3dbfd5356d4a0ddf34f9c15f5dc1997a 100755
--- a/scripts/generate-nix-overrides.hs
+++ b/scripts/generate-nix-overrides.hs
@@ -45,7 +45,7 @@ mkOverride (display -> pName, patches) =
 
 override :: FilePath -> FilePath -> FilePath -> String -> PatchType -> String
 override prefix patchDir extlessPath nixexpr ptype =
-  unwords ["(", patchFunction ptype, nixexpr, prefix </> patchDir </> addExtension extlessPath (patchTypeExt ptype), ")"]
+  unwords ["(", patchFunction ptype, prefix </> patchDir </> addExtension extlessPath (patchTypeExt ptype), nixexpr, ")"]
 
 generateOverride :: FilePath -> FilePath -> (FilePath, [PatchType]) -> IO (PackageName, ([Int], String))
 generateOverride prefix patchDir (patchExtless, patchTypes) = do
@@ -54,13 +54,13 @@ generateOverride prefix patchDir (patchExtless, patchTypes) = do
   let pname = display (packageName pid)
       version = versionNumbers (packageVersion pid)
   return . (packageName pid,) . (version,) $ 
-    "haskell.lib.doJailbreak (dontRevise "
+    "haskellLib.doJailbreak (dontRevise "
     ++ foldl' (override prefix patchDir patchExtless) ("super."++pname) patchTypes ++ ")"
 
 patchFunction :: PatchType -> String
 patchFunction = \case
   CabalPatch  -> "setCabalFile"
-  NormalPatch -> "haskell.lib.appendPatch"
+  NormalPatch -> "haskellLib.appendPatch"
 
 patchTypeExt :: PatchType -> String
 patchTypeExt = \case
@@ -85,9 +85,9 @@ main = do
                 [prefix, dir] -> return (prefix, dir)
                 _     -> fail "Usage: generate-nix-overrides [<prefix>, patchdir]"
   overrides <- generateOverrides prefix patchDir
-  putStrLn "{haskell}:"
-  putStrLn "let dontRevise = pkg: haskell.lib.overrideCabal pkg (old: { editedCabalFile = null; }); in"
-  putStrLn "let setCabalFile = pkg: file: haskell.lib.overrideCabal pkg (old: { postPatch = ''cp ${file} ${old.pname}.cabal''; }); in"
+  putStrLn "{haskellLib}:"
+  putStrLn "let dontRevise = haskellLib.overrideCabal (old: { editedCabalFile = null; }); in"
+  putStrLn "let setCabalFile = file: haskellLib.overrideCabal (old: { postPatch = ''cp ${file} ${old.pname}.cabal''; }); in"
   putStrLn "self: super: {\n"
   putStrLn overrides
   putStrLn "}"