Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sorri, a simpler lorri #282

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -6,3 +6,4 @@ dist-newstyle
.stack-work
# Cabal file can be generated from package.yaml but shouldn't be checked in
*.cabal
.envrc
8 changes: 7 additions & 1 deletion README.md
Expand Up @@ -33,7 +33,13 @@ $ nix-env -iA niv -f https://github.com/nmattia/niv/tarball/master \

## Build

Inside the provided nix shell:
When using [direnv](https://direnv.net), create the following `.envrc`:

```
. nix/sorri
```

then run (you can also run this in a nix-shell):

``` bash
$ repl
Expand Down
35 changes: 16 additions & 19 deletions default.nix
Expand Up @@ -145,14 +145,9 @@ let
# In order to make `Paths_niv(version)` available in `ghci`, we parse the
# version from `package.yaml` and create a dummy module that we inject in the
# `ghci` command.
niv-devshell = haskellPackages.shellFor {
buildInputs = [
pkgs.nixpkgs-fmt
pkgs.haskellPackages.ormolu
];
packages = ps: [ ps.niv ];
shellHook = ''
repl_for() {

repl_for = pkg:
''
haskell_version=$(jq <./package.yaml -cMr '.version' | sed 's/\./,/g')

paths_niv=$(mktemp -d)/Paths_niv.hs
Expand All @@ -162,20 +157,22 @@ let
echo "version :: Data.Version.Version" >> $paths_niv
echo "version = Data.Version.Version [$haskell_version] []" >> $paths_niv

niv_main=""

shopt -s globstar
ghci -clear-package-db -global-package-db -Wall app/$1.hs src/**/*.hs $paths_niv
}

repl() {
repl_for NivTest
}
ghci -clear-package-db -global-package-db -Wall app/${pkg}.hs src/**/*.hs $paths_niv
'';

repl_niv() {
repl_for Niv
}
repl_niv = pkgs.writeScriptBin "repl_niv" (repl_for "Niv");
repl = pkgs.writeScriptBin "repl" (repl_for "NivTest");

niv-devshell = haskellPackages.shellFor {
buildInputs = [
pkgs.nixpkgs-fmt
pkgs.haskellPackages.ormolu
repl_niv
repl
];
packages = ps: [ ps.niv ];
shellHook = ''
echo "To start a REPL for the test suite, run:"
echo " > repl"
echo " > :main"
Expand Down