Cabal install executable from hackage through sandbox?

When I run cabal install [pkg] and pkg is a command line executable instead of a library, it often warns me with this message: "Warning: the following packages may be damaged by reinstallations"

I always use the --force-reinstalls option to continue.

But since I install the executable and NOT the library, is there a way to run cabal install to isolate the build process in the isolated cabal sandbox, and then install the executable in ~/.cabal/bin ? Or is this something I need to write a custom bash script for?

+6
source share
1 answer

I always create a sandbox for my tools, for example, hoogle , pointfree , haddock , ghc-mod , hlint , shake and stylish-haskell . Just follow these steps:

  • Create a bonded sandbox with cabal sandbox init in your chosen location.
  • Run cabal install [pkg1 [pkg2 ...]]
  • After completion, copy the necessary executable files from the .cabal-sandbox/bin folder to the ~/.cabal/bin/ .
  • Run cabal sandbox delete to remove a very large sandbox that you no longer need.

These executables are usually completely self-contained, so you can create them based on the requests they request in the sandbox, and then move them to where you want. This, of course, helps maintain the integrity of your system and resolve conflicts.

+8
source

Source: https://habr.com/ru/post/979054/


All Articles