Add nix support files

`default.nix` for building the project with `nix-build` using systems
`<nixpkgs>` and default compiler.

`shell.nix` to allow usage of `nix-shell` to enter development shell.

`default.nix` uses `withImplicitSnap = false` default.

To build with `implicitsnap` use

```
nix-build --arg withImplicitSnap true
```

`shell.nix` enables `withImplicitSnap` by default and can be overriden with

```
nix-shell --arg withImplicitSnap false
```
This commit is contained in:
Richard Marko 2020-07-10 16:13:17 +02:00
parent 9ac59e955e
commit d963072261
2 changed files with 9 additions and 0 deletions

7
default.nix Normal file
View File

@ -0,0 +1,7 @@
{ pkgs ? import <nixpkgs> {}, withImplicitSnap ? false }:
let
src = pkgs.nix-gitignore.gitignoreSource [ ] ./.;
in
if withImplicitSnap
then pkgs.haskellPackages.callCabal2nixWithOptions "implicit" src "-fimplicitsnap" { }
else pkgs.haskellPackages.callCabal2nix "implicit" src { }

2
shell.nix Normal file
View File

@ -0,0 +1,2 @@
{ pkgs ? import <nixpkgs> {}, withImplicitSnap ? true }:
(import ./default.nix { inherit pkgs withImplicitSnap; }).env