git.iko.soy/typeable/cabal2nix
on master help sign in
stack: install bash-completion file in post-process hook
d281a60Peter Simons
distribution-nixpkgs/src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs+10
@@ -57,6 +57,7 @@ hooks =
57 , ("mysql", set (libraryDepends . system . contains (pkg "mysql")) True)
57 , ("mysql", set (libraryDepends . system . contains (pkg "mysql")) True)
58 , ("readline", over (libraryDepends . system) (Set.union (pkgs ["readline", "ncurses"])))
58 , ("readline", over (libraryDepends . system) (Set.union (pkgs ["readline", "ncurses"])))
59 , ("rocksdb-haskell", set (metaSection . platforms) (Set.singleton (Platform X86_64 Linux)))
59 , ("rocksdb-haskell", set (metaSection . platforms) (Set.singleton (Platform X86_64 Linux)))
60+ , ("stack", set phaseOverrides stackPostInstall)
60 , ("target", set (testDepends . system . contains (pkg "z3")) True)
61 , ("target", set (testDepends . system . contains (pkg "z3")) True)
61 , ("terminfo", set (libraryDepends . system . contains (pkg "ncurses")) True)
62 , ("terminfo", set (libraryDepends . system . contains (pkg "ncurses")) True)
62 , ("thyme", set (libraryDepends . tool . contains (bind "self.cpphs")) True) -- required on Darwin
63 , ("thyme", set (libraryDepends . tool . contains (bind "self.cpphs")) True) -- required on Darwin
@@ -160,6 +161,15 @@ agdaPostInstall = unlines
160 , "'';"
161 , "'';"
161 ]
162 ]
162
163
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+
163{-
173{-
164postProcess' :: Derivation -> Derivation
174postProcess' :: Derivation -> Derivation
165postProcess' deriv@(MkDerivation {..})
175postProcess' deriv@(MkDerivation {..})