-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
142 lines (134 loc) · 3.87 KB
/
default.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
{ sources ? import ./nix/sources.nix }: # import the sources
with
{ overlay = _: pkgs:
{ niv = import sources.niv {}; # use the sources :)
};
};
let pkgs = (import (sources.nixpkgs-static + "/survey/default.nix") {}).pkgs; in
let compiler = "ghc865"; in
let strip = true; in
let
telegram-api-pkg = { mkDerivation, stdenv, fetchFromGitHub
, aeson
, containers
, http-api-data
, http-client
, servant
, servant-client
, servant-client-core
, mtl
, text
, transformers
, http-media
, http-types
, mime-types
, string-conversions
, binary
, ansi-wl-pprint
, hjpath
, hspec
, http-client-tls
, optparse-applicative
}:
mkDerivation {
pname = "telegram-api";
version = "0.7.1.0";
src = fetchFromGitHub {
owner = "klappvisor";
repo = "haskell-telegram-api";
rev = "abbfd76c40f2783c113b660184a03cc94d58e751";
sha256 = "0mzhigdyj5jdwycmz587s05zp5c7wcf7njw3x866iln59kp0rgi3";
};
isLibrary = true;
isExecutable = false;
enableSharedExecutables = false;
enableSharedLibraries = false;
libraryHaskellDepends = [
aeson
containers
http-api-data
http-client
servant
servant-client
servant-client-core
mtl
text
transformers
http-media
http-types
mime-types
string-conversions
binary
ansi-wl-pprint
hjpath
hspec
http-client-tls
optparse-applicative
servant-client
];
jailbreak = true; # want servant-client-0.16.0.1, not 0.16
license = stdenv.lib.licenses.bsd3;
};
umklappbot-pkg = { mkDerivation, base, stdenv,
aeson,
aws-lambda-haskell-runtime,
telegram-api,
aws,
pretty-show,
uuid,
}:
mkDerivation {
pname = "umklappbot";
version = "0.1.0.0";
src = pkgs.lib.sourceByRegex ./. [
".*\.cabal$"
"LICENSE"
"^src.*"
];
isLibrary = false;
isExecutable = true;
enableSharedExecutables = false;
enableSharedLibraries = false;
executableHaskellDepends = [ base
aeson
aws-lambda-haskell-runtime
telegram-api
aws
pretty-show
uuid
];
license = stdenv.lib.licenses.bsd3;
configureFlags = [
"--ghc-option=-optl=-static"
"--extra-lib-dirs=${pkgs.gmp6.override { withStatic = true; }}/lib"
"--extra-lib-dirs=${pkgs.zlib.static}/lib"
"--extra-lib-dirs=${pkgs.libffi.overrideAttrs (old: { dontDisableStatic = true; })}/lib"
] ++ pkgs.lib.optionals (!strip) [
"--disable-executable-stripping"
] ;
};
haskellPackages = with pkgs.haskell.lib; pkgs.haskell.packages.${compiler}.override {
overrides = self: super: {
# Dependencies we need to patch
hpc-coveralls = appendPatch super.hpc-coveralls (builtins.fetchurl https://github.com/guillaume-nargeot/hpc-coveralls/pull/73/commits/344217f513b7adfb9037f73026f5d928be98d07f.patch);
telegram-api = self.callPackage telegram-api-pkg {};
};
};
umklappbot = haskellPackages.callPackage umklappbot-pkg {};
function-zip = pkgs.runCommandNoCC "umklappbot-function.zip" {
buildInputs = [ pkgs.zip ];
} ''
mkdir -p $out
cp ${umklappbot}/bin/umklappbot bootstrap
zip $out/function.zip bootstrap
'';
shell = umklappbot.env.overrideAttrs(old: {
preferLocalBuild = true;
allowSubstitutes = true;
});
in
{ inherit
umklappbot
function-zip
shell;
}