forked from kadena-io/chainweaver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
obApp.nix
152 lines (140 loc) · 6.83 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
{ 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";
__closureCompilerOptimizationLevel = "SIMPLE";
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.26";
sha256 = "1kdkisj534nv5r0m3gmxy2iqgsn6y1dd881x77a87ynkx1glxfva";
} {});
};
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;
})