-
Notifications
You must be signed in to change notification settings - Fork 29
/
obApp.nix
178 lines (167 loc) · 7.96 KB
/
obApp.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
{ system ? builtins.currentSystem # TODO: Get rid of this system cruft
, iosSdkVersion ? "10.2"
, withHoogle ? false
, obelisk
}:
let
pkgs = obelisk.reflex-platform.nixpkgs;
optionalExtension = cond: overlay: if cond then overlay else _: _: {};
getGhcVersion = ghc: if ghc.isGhcjs or false then ghc.ghcVersion else ghc.version;
haskellLib = pkgs.haskell.lib;
in with obelisk;
project ./. ({ pkgs, hackGet, ... }: with pkgs.haskell.lib; {
inherit withHoogle;
# android.applicationId = "systems.obsidian.obelisk.examples.minimal";
# android.displayName = "Obelisk Minimal Example";
# ios.bundleIdentifier = "systems.obsidian.obelisk.examples.minimal";
# ios.bundleName = "Obelisk Minimal Example";
externjs = ./static/externs.js;
staticFiles =
let
staticFilePath = ./static;
in
pkgs.runCommand "minify" { buildInputs = [ pkgs.xorg.lndir ]; }
''
mkdir -p $out
cd $out
lndir -silent ${staticFilePath} $out
'${pkgs.closurecompiler}/bin/closure-compiler' --externs 'externs.js' --externs '${reflex-platform.ghcjsExternsJs}' --language_in=ECMASCRIPT_2018 --jscomp_warning=checkVars --js_output_file="js/kadena-crypto.min.js" "js/kadena-crypto.js"
'';
shellToolOverrides = ghc: super: {
z3 = pkgs.z3;
};
packages =
let
servantSrc = hackGet ./dep/servant;
reflex-dom-src = hackGet ./dep/reflex-dom;
in
{
# servant-client-core = servantSrc + "/servant-client-core";
# servant = servantSrc + "/servant";
servant-jsaddle = hackGet ./dep/servant-jsaddle;
# Playing with attempts at fixing the xhr spin problem
# jsaddle = hackGet ./dep/jsaddle + /jsaddle;
jsaddle-warp = hackGet ./dep/jsaddle + /jsaddle-warp; #https://github.com/ghcjs/jsaddle/pull/114
kadena-signing-api = hackGet ./dep/signing-api + "/kadena-signing-api";
pact = hackGet ./dep/pact;
reflex-dom = reflex-dom-src + "/reflex-dom";
reflex-dom-core = reflex-dom-src + "/reflex-dom-core";
reflex-dom-ace = hackGet ./dep/reflex-dom-ace;
reflex-dom-contrib = hackGet ./dep/reflex-dom-contrib;
dependent-sum-aeson-orphans = hackGet ./dep/dependent-sum-aeson-orphans;
servant-github = hackGet ./dep/servant-github;
obelisk-oauth-common = hackGet ./dep/obelisk-oauth + /common;
obelisk-oauth-frontend = hackGet ./dep/obelisk-oauth + /frontend;
obelisk-oauth-backend = hackGet ./dep/obelisk-oauth + /backend;
HsYAML-aeson = hackGet ./dep/HsYAML-aeson;
# Needed for obelisk-oauth currently (ghcjs support mostly):
entropy = hackGet ./dep/entropy;
crc = hackGet ./dep/crc;
cardano-crypto = hackGet ./dep/cardano-crypto;
desktop = ./desktop;
mac = builtins.filterSource (path: type: !(builtins.elem (baseNameOf path) ["static"])) ./mac;
linux = builtins.filterSource (path: type: !(builtins.elem (baseNameOf path) ["static"])) ./linux;
};
overrides = let
inherit (pkgs) lib;
mac-overlay = self: super: {
# Mac app static linking
mac = pkgs.haskell.lib.overrideCabal super.mac (drv: {
preBuild = ''
mkdir include
ln -s ${pkgs.darwin.cf-private}/Library/Frameworks/CoreFoundation.framework/Headers include/CoreFoundation
export NIX_CFLAGS_COMPILE="-I$PWD/include $NIX_CFLAGS_COMPILE"
'';
libraryFrameworkDepends =
(with pkgs.darwin; with apple_sdk.frameworks; [
Cocoa
WebKit
]);
# Hiding the static libs from the dylibs seems to be the only way i am able
# to statically link against libcrypto
preConfigure = let openssl-static = (pkgs.openssl.override { static = true; }).out; in ''
mkdir -p openssl-static-libs
cp ${openssl-static}/lib/libcrypto.a openssl-static-libs
cp ${openssl-static}/lib/libssl.a openssl-static-libs
'';
configureFlags = [
"--ghc-option=-optl=-Lopenssl-static-libs"
"--ghc-option=-optl=-lcrypto"
"--ghc-option=-optl=-lssl"
"--ghc-option=-optl=${pkgs.darwin.libiconv.override { enableShared = false; enableStatic = true; }}/lib/libiconv.a"
"--ghc-option=-optl=${pkgs.zlib.static}/lib/libz.a"
"--ghc-option=-optl=${pkgs.gmp6.override { withStatic = true; }}/lib/libgmp.a"
"--ghc-option=-optl=/usr/lib/libSystem.dylib"
"--ghc-option=-optl=${pkgs.libffi.override {
stdenv = pkgs.stdenvAdapters.makeStaticLibraries pkgs.stdenv;
}}/lib/libffi.a"
];
});
};
linux-overlay = self: super: {
gi-gtk-hs = self.callHackageDirect {
pkg = "gi-gtk-hs";
ver = "0.3.7.0";
sha256 = "0h5959ayjvipj54z0f350bz23fic90xw9z06xw4wcvxvwkrsi2br";
} { };
};
guard-ghcjs-overlay = self: super:
let hsNames = [ "cacophony" "haskeline" "katip" "ridley" ];
in lib.genAttrs hsNames (name: null);
ghcjs-overlay = self: super: {
# I'm not sure if these hang or just take a long time
hourglass = haskellLib.dontCheck super.hourglass;
x509 = haskellLib.dontCheck super.x509;
tls = haskellLib.dontCheck super.tls;
x509-validation = haskellLib.dontCheck super.x509-validation;
# failing
mono-traversable = haskellLib.dontCheck super.mono-traversable; #https://github.com/ghcjs/ghcjs-base/issues/128
conduit = haskellLib.dontCheck super.conduit;
unliftio = haskellLib.dontCheck super.unliftio;
};
common-overlay = self: super: {
brittany = haskellLib.dontCheck super.brittany;
jsaddle-warp = haskellLib.dontCheck super.jsaddle-warp; # webdriver fails to build
reflex-dom-contrib = haskellLib.doJailbreak (haskellLib.dontCheck super.reflex-dom-contrib); # webdriver fails to build
reflex-dom-core = haskellLib.dontCheck super.reflex-dom-core; # webdriver fails to build
servant-jsaddle = haskellLib.dontCheck (haskellLib.doJailbreak super.servant-jsaddle);
semialign = haskellLib.doJailbreak super.semialign; # vector bounds
these-lens = haskellLib.doJailbreak super.these-lens; # lens bounds
pact = haskellLib.dontCheck super.pact; # tests can timeout...
system-locale = haskellLib.dontCheck super.system-locale; # tests fail on minor discrepancies on successfully parsed locale time formats.
typed-process = haskellLib.dontCheck super.typed-process;
pact-time = haskellLib.dontCheck (self.callHackageDirect {
pkg = "pact-time";
ver = "0.2.0.0";
sha256 = "1cfn74j6dr4279bil9k0n1wff074sdlz6g1haqyyy38wm5mdd7mr";
} {});
direct-sqlite = dontCheck (self.callHackageDirect {
pkg = "direct-sqlite";
ver = "2.3.27";
sha256 = "0w8wj3210h08qlws40qhidkscgsil3635zk83kdlj929rbd8khip";
} {});
sbv = dontCheck (self.callHackageDirect {
pkg = "sbv";
ver = "9.0";
sha256 = "14g2qax1vc7q4g78fa562dviqvcd0l52kd5jmgv90g3g3ci15bnl";
} {});
# sbv requires this even though it is not used in the build (and the hash is invalid)
tasty-bench = dontCheck (self.callHackageDirect {
pkg = "tasty-bench";
ver = "0.3.1";
sha256 = "0000000000000000000000000000000000000000000000000000";
} {});
libBF = doJailbreak (dontCheck (self.callHackageDirect {
pkg = "libBF";
ver = "0.6.3";
sha256 = "0j0i39jb389rnrkkw2xqz10471afxys79nf31hhlqr4fk6ddhjf7";
} {}));
};
in self: super: lib.foldr lib.composeExtensions (_: _: {}) [
mac-overlay
linux-overlay
common-overlay
(optionalExtension (super.ghc.isGhcjs or false) guard-ghcjs-overlay)
(optionalExtension (super.ghc.isGhcjs or false) ghcjs-overlay)
] self super;
})