-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
65 lines (60 loc) · 2.02 KB
/
flake.nix
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
61
62
63
64
65
{
description = "hasql-effectful";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, pre-commit-hooks, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
ghcVersion = "ghc946";
frameworks = pkgs.darwin.apple_sdk.frameworks;
# haskellPackages = pkgs.haskell.packages."${ghcVersion}";
in
{
checks = {
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
nixpkgs-fmt.enable = true;
fourmolu.enable = true;
};
settings = {
ormolu.defaultExtensions = [ "ImportQualifiedPost" "TypeApplications" ];
};
};
};
devShell = nixpkgs.legacyPackages.${system}.mkShell {
buildInputs = [
frameworks.Cocoa
];
nativeBuildInputs = [
pkgs.zlib
pkgs.xz
pkgs.just
pkgs.cabal-install
pkgs.haskell.packages."${ghcVersion}".haskell-language-server
pkgs.haskell.compiler."${ghcVersion}"
pkgs.postgresql_16
pkgs.process-compose
pkgs.jq
];
shellHook = ''
${self.checks.${system}.pre-commit-check.shellHook}
export LANG=en_US.UTF-8
export PGHOST="$PWD/db"
export PGDATA="$PGHOST/db"
export PGLOG=$PGHOST/postgres.log
export PGDATABASE=hasql-effectful
export PG_CONNECTION_STRING=postgresql://$(jq -rn --arg x $PGHOST '$x|@uri')/$PGDATABASE
export PC_PORT_NUM=9999
mkdir -p $PGHOST
mkdir -p .dev
if [ ! -d $PGDATA ]; then
initdb --auth=trust --no-locale --encoding=UTF8
fi
'';
};
}
);
}