Skip to content

monadfix/nix-cabal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

nix-cabal

nix-logo cabal-logo

This is a small wrapper script to run cabal inside nix-shell. It assumes shell.nix to be present in the current directory.

Installation

Download the script to a location of your choice, for instance $HOME/.local/bin/, and make it executable:

curl https://raw.githubusercontent.com/monadfix/nix-cabal/master/nix-cabal -o $HOME/.local/bin/nix-cabal
chmod u+x $HOME/.local/bin/nix-cabal

Make sure this location is in your $PATH.

Usage

nix-cabal v2-build all

Here's an example of a shell.nix you might want to use with this script:

{
  pkgs ? import <nixpkgs> {},
  hc ? "ghc844"
}:

pkgs.stdenv.mkDerivation rec {
  name = "example";
  buildInputs = [
    pkgs.haskell.compiler.${hc}
    pkgs.git
    pkgs.zlib
    pkgs.cabal-install
    pkgs.pkgconfig
    pkgs.which
  ];
  shellHook = ''
    export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath buildInputs}:$LD_LIBRARY_PATH
    export LANG=en_US.UTF-8
  '';
  LOCALE_ARCHIVE =
    if pkgs.stdenv.isLinux
    then "${pkgs.glibcLocales}/lib/locale/locale-archive"
    else "";
}

Travis CI

Here's an example of a .travis.yml:

language: nix

os:
  - linux
  - osx

env:
  - HC=ghc822
  - HC=ghc844
  - HC=ghc861

before_install:
  - curl https://raw.githubusercontent.com/monadfix/nix-cabal/master/nix-cabal -o nix-cabal && chmod u+x nix-cabal
  - travis_retry ./nix-cabal v2-update

script:
  - ./nix-cabal v2-test
  - ./nix-cabal v2-bench

cache:
  directories:
    - ~/.cabal
    - ~/.ghc

Releases

No releases published

Packages

No packages published

Languages