Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/calvinchengx/cabalenv
A simple `zsh` script that simplifies the management of haskell's cabal sandboxes.
https://github.com/calvinchengx/cabalenv
Last synced: 26 days ago
JSON representation
A simple `zsh` script that simplifies the management of haskell's cabal sandboxes.
- Host: GitHub
- URL: https://github.com/calvinchengx/cabalenv
- Owner: calvinchengx
- License: bsd-2-clause
- Created: 2015-01-03T04:28:46.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-05-11T13:29:29.000Z (almost 10 years ago)
- Last Synced: 2024-11-16T01:36:55.632Z (3 months ago)
- Language: Shell
- Homepage:
- Size: 168 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CabalEnv
A simple `zsh` script that works with `cabal sandbox` initialised in the same directory as the project directory.
## Usage
### Create a new cabalenv
`your_proj_dir` is equivalent to `THE_CABAL_ENVIRONMENT_NAME`.
```
cd $PROJECT_HOME/your_proj_dir
cabal sandbox init
cabalenv your_proj_dir
```### List existing cabalenv
`lscabalenv` returns a list of directory names that contain `.cabal-sandbox`. In the context of our `cabalenv` utility, we refer to these directory names as **cabal environment names**.
### Switch into an existing cabalenv
When a particular `.cabal-sandbox/bin` path is in `$PATH`, the `$CABAL_ENV` environment variable will be assigned the cabal environment name and the `$PROMPT` will also be updated to show the cabal environment name.
So, to begin working on a project, simply run
`cabalenv THE_CABAL_ENVIRONMENT_NAME`
This `cabalenv` function will update
* `$PATH` with `THE_CABAL_ENVIRONMENT_NAME`'s cabal sandbox path
* set `$CABAL_ENV` with the current cabal environment name
* update `$PROMPT` with `THE_CABAL_ENVIRONMENT_NAME``runhaskells` is a wrapper command that automatically finds the cabal sandbox's package path and assign it to the `-package-db` flag
`ghcs` is a wrapper command that automatically finds the cabal sandbox's package path and assign it to the `-package-db` flag
## Installation
### 1. Download script and place in /usr/local/bin
Example 1:
```
cd /usr/local/bin
sudo wget https://raw.githubusercontent.com/calvinchengx/cabalenv/master/cabalenv.sh
sudo chmod +x cabalenv.sh
```Example 2:
```
git clone [email protected]:calvinchengx/cabalenv.git
cd cabalenv
sudo ln -s "$(pwd)/cabalenv.sh" /usr/local/bin/cabalenv.sh
sudo chmod +x /usr/local/bin/cabalenv.sh
```### 2. Set $HS_PROJ_HOME and source the cabalenv.sh file
In your `~/.zprofile`, specify
```
export HS_PROJ_HOME=$HOME/work
source `which cabalenv.sh`
```where `work` is just a place where I create all my haskell project directories in. You don't have to use `work` of course.
## Current Limitations, i.e. TODOs
* Does not support *shared* cabal sandboxes yet.
* Only works on `zsh`. Will support `bash` in due course.
* A simple command to get out of current cabal environment.
* Package it for `brew` and for `port`, perhaps.