#!/bin/bash

#stack install --nix --profile --test --fast --no-install-ghc --skip-ghc-check

# Another solution to build
# nix-shell
# stack build
# If you have a linker issue:
# stack build --extra-lib-dirs=/nix/store/r3x96j3kmcs8dv4l02rrjmbhm535jycy-icu4c-72.1/lib

if [[ $1 == "dev" ]] ;
  then
    echo "DEV install"
    #env LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 stack --nix install --no-install-ghc --skip-ghc-check --no-haddock-deps
  else
    echo "PROD install (with documentation)"
    nix-shell --run "cabal update && cabal build && cabal --overwrite-policy=always install"
    #env LANG=C.UTF-8 stack install --haddock --nix --test --no-install-ghc --skip-ghc-check --no-haddock-deps
fi