-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathflake.nix
145 lines (137 loc) · 5.52 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
{
description = "hasql-interpolate";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { self, flake-utils, nixpkgs, flake-compat }:
flake-utils.lib.eachDefaultSystem
(system:
let
compiler = "ghc9101";
pkgs = nixpkgs.legacyPackages."${system}".extend self.overlay;
ghc = pkgs.haskell.packages."${compiler}";
in
{
apps.repl = flake-utils.lib.mkApp {
drv = nixpkgs.legacyPackages."${system}".writeShellScriptBin "repl" ''
confnix=$(mktemp)
echo "builtins.getFlake (toString $(git rev-parse --show-toplevel))" >$confnix
trap "rm $confnix" EXIT
nix repl $confnix
'';
};
devShells.default = ghc.shellFor {
withHoogle = false;
packages = hpkgs:
with hpkgs;
with pkgs.haskell.lib;
[
hasql-interpolate
];
buildInputs = [
pkgs.cabal-install
];
};
inherit pkgs;
packages = { hasql-interpolate = ghc.hasql-interpolate; };
nixpkgs = pkgs;
defaultPackage = self.packages."${system}".hasql-interpolate;
checks = pkgs.lib.attrsets.genAttrs [ "ghc965" "ghc982" "ghc9101" ]
(ghc-ver: pkgs.haskell.packages."${ghc-ver}".hasql-interpolate);
}) // {
overlay = final: prev: {
haskell = with prev.haskell.lib;
prev.haskell // {
packages =
let
ghcs = prev.lib.filterAttrs
(k: v: prev.lib.strings.hasPrefix "ghc" k)
prev.haskell.packages;
patchedGhcs = builtins.mapAttrs patchGhc ghcs;
patchGhc = k: v:
prev.haskell.packages."${k}".extend (self: super:
with prev.haskell.lib;
with builtins;
with prev.lib.strings;
let
cleanSource = pth:
let
src' = prev.lib.cleanSourceWith {
filter = filt;
src = pth;
};
filt = path: type:
let
bn = baseNameOf path;
isHiddenFile = hasPrefix "." bn;
isFlakeLock = bn == "flake.lock";
isNix = hasSuffix ".nix" bn;
in
!isHiddenFile && !isFlakeLock && !isNix;
in
src';
in
{
tmp-postgres =
let
src = prev.fetchFromGitHub {
owner = "jfischoff";
repo = "tmp-postgres";
rev = "7f2467a6d6d5f6db7eed59919a6773fe006cf22b";
hash = "sha256-dE1OQN7I4Lxy6RBdLCvm75Z9D/Hu+9G4ejV2pEtvL1A=";
};
pkg = self.callCabal2nix "tmp-postgres" src { };
in
overrideCabal pkg (drv: {
libraryToolDepends = drv.libraryToolDepends or [ ] ++ [ final.postgresql ];
doCheck = false;
});
hasql = dontCheck (super.callHackageDirect
{
pkg = "hasql";
ver = "1.8";
sha256 = "01kfj0dan0qp46r168mqz3sbsnj09mwbc0zr72jdm32fhi6ck57r";
}
{ });
postgresql-binary = dontCheck (super.callHackageDirect
{
pkg = "postgresql-binary";
ver = "0.14";
sha256 = "0h3islag95f7rlxzr38ixhv2j9g18gp17jqypk8fax39f9xy3mcm";
}
{ });
postgresql-libpq = dontCheck (super.callHackageDirect
{
pkg = "postgresql-libpq";
ver = "0.10.1.0";
sha256 = "1zhmph5g1nqwy1x7vc6r6qia6flyzr0cfswgjhi978mw4fl8qwxm";
}
{ });
hasql-interpolate =
let
p = self.callCabal2nix "hasql-interpolate"
(cleanSource ./.)
{ };
in
overrideCabal p (drv: {
testToolDepends = drv.libraryToolDepends or [ ] ++ [ final.postgresql ];
# tmp-postgres is failing to initialize a db in the
# nix env now, but I haven't had time to figure out
# why. Once resolved we can reenable the test suite in
# CI.
doCheck = false;
revision = null;
editedCabalFile = null;
});
});
in
prev.haskell.packages // patchedGhcs;
};
};
};
}