Add support for building and installing with Nix (#103)

* Fix version lock on shellmet

$? operator's semantic has changed in 0.0.1.

* Add default.nix, enabling Nix based install

- Also add `./result` to .gitignore (gets created by `nix-build`)
- Pin a version of nixpkgs that has the GHC used by stack.yaml (8.6.5)
This commit is contained in:
Sridhar Ratnakumar 2019-08-04 23:32:18 -04:00 committed by Dmitrii Kovanikov
parent 3a4d7793e4
commit b8ad58d172
4 changed files with 39 additions and 1 deletions

2
.gitignore vendored
View File

@ -24,6 +24,8 @@ cabal.project.local
# Stack
.stack-work/
stack.yaml.lock
# Nix
result
### IDE/support
# Vim

View File

@ -84,6 +84,11 @@ You need to follow these steps:
```shell
stack install hit-on
```
* [Nix](https://nixos.org/nix/)
```shell
nix-env -f . -i
```
4. Make sure that `hit` is installed:
```shell

31
default.nix Normal file
View File

@ -0,0 +1,31 @@
{ # The git revision here corresponds to the nixpkgs-unstable channel, which at
# the time of this writing has GHC 8.6.5 as the default compiler (matching the
# one used by stack.yaml). Use https://howoldis.herokuapp.com/ to determine
# the current rev.
pkgs ? import (builtins.fetchTarball "https://github.com/nixos/nixpkgs/archive/002b853782e.tar.gz") {}
# Which GHC compiler to use.
# To determine the list of compilers available run:
# nix-env -f "<nixpkgs>" -qaP -A haskell.compiler
, compiler ? "default"
}:
let
haskellPackages =
if compiler == "default"
then pkgs.haskellPackages
else pkgs.haskell.packages.${compiler};
in
haskellPackages.developPackage {
# The path to our cabal project's root directory
root = ./.;
# Haskell packages to override
source-overrides = {
github = builtins.fetchTarball "https://github.com/phadej/github/archive/cdae698f50f9e6dc1b58d2181672294e2b11dfb3.tar.gz";
relude = builtins.fetchTarball "https://github.com/kowainik/relude/archive/55968311244690f5cc8b4484a37a63d988ea2ec4.tar.gz";
shellmet = builtins.fetchTarball "https://github.com/kowainik/shellmet/archive/36149eb0eb2b81916a93cdb92f3cb949d2eb9d23.tar.gz";
};
overrides = self: super: with pkgs.haskell.lib; {
github = dontCheck super.github; # `dontCheck` skips running tests on this package
};
}

View File

@ -69,7 +69,7 @@ library
, optparse-applicative ^>= 0.14
, process ^>= 1.6
, relude ^>= 0.5
, shellmet >= 0.0.0
, shellmet >= 0.0.1
, text
, vector ^>= 0.12