Giter VIP home page Giter VIP logo

cabal-env's Introduction

cabal-env

cabal-env is a prototype UI for managing the new package environments facility implement in GHC for use by cabal's nix-style local builds which allows to provide seamless access to the nix-style package store for direct invocations GHC and GHCi.

NOTE: A newer different prototype (different implementation, but same name cabal-env) can be found at https://github.com/phadej/cabal-env

Usage

Usage: ./cabal-env.sh [-n <env-name>] (-r | -l | [DEP]+)"

Creates GHC package environment named '<env-name>' (default = 'default')
containing the specified deps.

Flags:

  -n <env-name>   set environment name to operate on;
                  use the special env-name '.' to create a
                  local '.ghc.environment' file in the current folder.
                  (default: 'default')

  -r              deletes the specified environment (via -n)

  -l              lists available environments for current 'ghc'
                  (cannot be combined with other flags)

  -i              create temporary environment and invoke GHCi with it
                  (cannot be combined with other flags)

  -s <script>     run script (via 'runghc') in temporary environment

GHC Package environments are supported since GHC 8.0.2 and Cabal 2.2;
By default, the environment named 'default' is loaded by GHC and GHCi
if it exists.

You can select a specific package environment for GHC(i) via e.g.
'ghci -package-env myenv' or by setting an environment variable
'GHC_ENVIRONMENT=myenv ghci'

Examples:

  ./cabal-env.sh -n lens 'lens == 4.15.*' 'lens-aeson == 1.0.*' http-streams

  ./cabal-env.sh unordered-containers QuickCheck quickcheck-instances

  ./cabal-env.sh -s webcrawler.hs wreq

  ./cabal-env.sh -i lens-aeson

cabal-env's People

Contributors

hvr avatar mkoppmann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cabal-env's Issues

Error with globbing

Adding set -x to the script gives:

% cabal-env.sh ghc-exactprint
+ remove=false
+ list=false
+ run_ghci=false
+ envname=default
+ hscript=
+ getopts lrin:s: flag
+ shift 0
+ false
+ false
+ '[' 1 -lt 1 ']'
+ echo 'Using environment-name = '\''default'\'''
Using environment-name = 'default'
++ mktemp -d
+ TMPDIR=/tmp/tmp.bwtCwRuJAk
++ pwd
+ PWD0=/home/alex/Documents/Haskell/ProperScoring
+ pushd /tmp/tmp.bwtCwRuJAk
/tmp/tmp.bwtCwRuJAk ~/Documents/Haskell/ProperScoring
+ cat
+ for DEP in "$@"
+ echo '  build-depends: ghc-exactprint'
+ cat
+ cabal new-build all
Resolving dependencies...
Build profile: -w ghc-8.8.1 -O1
In order, the following will be built (use -v for more details):
 - z-0 (lib) (first run)
Configuring library for z-0..
Preprocessing library for z-0..
Building library for z-0..
+ for ENVFN in .ghc.environment.*-*-*
+ true
+ '[' -z '.ghc.environment.*-*-*' ']'
+ echo 'Found '\''.ghc.environment.*-*-*'\'''
Found '.ghc.environment.*-*-*'
+ TRIPLET='*-*-*'
+ '[' -n '' ']'
+ false
+ '[' default = . ']'
+ ENVSDIR='/home/alex/.ghc/*-*-*/environments/'
+ mkdir -v -p '/home/alex/.ghc/*-*-*/environments/'
mkdir: created directory '/home/alex/.ghc/*-*-*'
mkdir: created directory '/home/alex/.ghc/*-*-*/environments/'
+ ENVSDIRFN='/home/alex/.ghc/*-*-*/environments/default'
+ grep -v '^package-db dist-newstyle/'
+ grep -v '^package-id z-0-inplace'
+ cat '.ghc.environment.*-*-*'
cat: '.ghc.environment.*-*-*': No such file or directory

% bash --version
GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Fails with puzzling error

bash-3.2$ ./cabal-env/cabal-env.sh foo -n hmatrix
Using environment-name = 'default'
/var/folders/h1/bkwn2ct12hvb6__dzrk5gwx80000gn/T/tmp.Qg6IiA5O ~/Dropbox/Tidy/TestCabalEnv
CabalFileParseError "./z.cabal" [PError (Position 9 18) "\nunexpected '-'\nexpecting white space or end of input\n\n-n\n"] (Just (mkVersion [1,8])) []

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.