@@ -57,6 +57,7 @@ hooks =
5757 , ("mysql", set (libraryDepends . system . contains (pkg "mysql")) True)
5858 , ("readline", over (libraryDepends . system) (Set.union (pkgs ["readline", "ncurses"])))
5959 , ("rocksdb-haskell", set (metaSection . platforms) (Set.singleton (Platform X86_64 Linux)))
60+ , ("stack", set phaseOverrides stackPostInstall)
6061 , ("target", set (testDepends . system . contains (pkg "z3")) True)
6162 , ("terminfo", set (libraryDepends . system . contains (pkg "ncurses")) True)
6263 , ("thyme", set (libraryDepends . tool . contains (bind "self.cpphs")) True) -- required on Darwin
@@ -160,6 +161,15 @@ agdaPostInstall = unlines
160161 , "'';"
161162 ]
162163
164+stackPostInstall :: String
165+stackPostInstall = unlines
166+ [ "postInstall = ''"
167+ , " exe=$out/bin/stack"
168+ , " mkdir -p $out/share/bash-completion/completions"
169+ , " $exe --bash-completion-script $exe >$out/share/bash-completion/completions/stack"
170+ , "'';"
171+ ]
172+
163173{-
164174postProcess' :: Derivation -> Derivation
165175postProcess' deriv@(MkDerivation {..})