Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# hs-flake-utils
A nix flake for use with Haskell, for Least Authority.
# How do I make it go?
1. create a directory
2. change into that directory
2. nix-shell -p cabal-install ghc
1. cabal init
2. answer all the questions to create the project files
3. copy the project template below into a file named `flake.nix`
1. replace the contents of `description` and `packageName` in the newly created `flake.nix`
4. run `nix develop`
Wait for the world to build or the internet to send you cached packages.
```haskell
{
description = "something about your cool project";
inputs = {
# Nix Inputs
nixpkgs.url = github:nixos/nixpkgs/?ref=nixos-22.11;
flake-utils.url = github:numtide/flake-utils;
hs-flake-utils.url = "git+https://whetstone.private.storage/jcalderone/hs-flake-utils.git?ref=main";
hs-flake-utils.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = {
self,
nixpkgs,
flake-utils,
hs-flake-utils,
}: let
ulib = flake-utils.lib;
ghcVersion = "ghc8107";
in
ulib.eachSystem ["x86_64-linux" "aarch64-darwin"] (system: let
# Get a nixpkgs customized for this system
pkgs = import nixpkgs {
inherit system;
};
hslib = hs-flake-utils.lib {
inherit pkgs;
src = ./.;
compilerVersion = ghcVersion;
packageName = "PACKAGENAME";
};
in {
checks = hslib.checks {};
devShells = hslib.devShells {
extraBuildInputs = pkgs:
with pkgs; [
zlib
];
};
packages = hslib.packages {};
});
}
```