mirror of
https://github.com/nmattia/snack.git
synced 2024-11-10 22:30:34 +03:00
1.4 KiB
1.4 KiB
Snack
snack is a Haskell build tool.
Usage
You need a snack.nix
:
{ pkgs ? import <nixpkgs> {} }: # see #install for instructions
pkgs.snack-lib.executable
{ src = ./src; # Where you source code is located
main = "Main"; # The name of your main module
# You Haskell dependencies
dependencies =
[
"heterocephalus"
"servant"
"servant-server"
"warp"
"unliftio"
"uuid"
];
# GHC options
ghc-options = [ "-Wall" ];
# Extra directories to add to your build, by module
extra-directories = modName:
if modName == "Main" then
[ ./pages ]
else [];
}
You can then build with:
$ snack build
or run with:
$ snack run
> ...
or start an interactive session:
$ snack ghci
> ...
Currently snack only supports building executables. See the test suite for examples.
Install
The easiest way to install it is to add it to your nix shell:
{ pkgs ? import <nixpkgs> {} }:
let
snack = (pkgs.callPackage path/to/snack {}).snack-exe;
in pkgs.mkShell
{ name = "snack-shell";
buildInputs = [ snack ];
}