forked from rmourey26/reflex-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.nix
141 lines (127 loc) · 5.8 KB
/
release.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
# This file aggregates some things for CI to build. It constants is unstable
# and shouldn't be used by other code using reflex-platform.
{ self-args ? { config.android_sdk.accept_license = true; }
, local-self ? import ./. self-args
, cacheBuildSystems ? [
"x86_64-linux"
# "i686-linux"
"x86_64-darwin"
]
}:
let
inherit (local-self.nixpkgs) lib;
getOtherDeps = reflex-platform: [
reflex-platform.nixpkgs.cabal2nix
reflex-platform.ghc.cabal2nix
] ++ builtins.concatLists (map
(crossPkgs: lib.optionals (crossPkgs != null) [
crossPkgs.buildPackages.haskellPackages.cabal2nix
]) [
reflex-platform.nixpkgsCross.ios.aarch64
reflex-platform.nixpkgsCross.android.aarch64
reflex-platform.nixpkgsCross.android.aarch32
]
);
drvListToAttrs = drvs:
lib.listToAttrs (map (drv: { inherit (drv) name; value = drv; }) drvs);
perPlatform = lib.genAttrs cacheBuildSystems (system: let
getRP = args: import ./. ((self-args // { inherit system; }) // args);
reflex-platform = getRP {};
reflex-platform-nojsstring = getRP { useTextJSString = false; };
jsexeHydra = exe: exe.overrideAttrs (attrs: {
postInstall = ''
${attrs.postInstall or ""}
mkdir -p $out/nix-support
echo $out/bin/reflex-todomvc.jsexe >> $out/nix-support/hydra-build-products
'';
});
# These don't work anymore, so they're pretty much disabled
benchmark = import ./nix-utils/benchmark { inherit reflex-platform; };
demoVM = import ./nix-utils/demo-vm { inherit reflex-platform; };
# TODO do we still need to do these to ensure srcs (only used at build time)
# make it to the cache? If not, we can just drop this and all the `_dep`
# attributes in the overlays.
dep = {}
// (lib.optionalAttrs reflex-platform.androidSupport reflex-platform.ghcAndroidAarch64._dep)
// reflex-platform.ghcjs8_6._dep
// benchmark.dep
;
skeleton-test = import ./tests/skeleton.nix { inherit reflex-platform; };
collect = v:
if lib.isDerivation v then [v]
else if lib.isAttrs v then lib.concatMap collect (builtins.attrValues v)
else if lib.isList v then lib.concatMap collect v
else [];
optDebugVariants = [
"unprofiled"
"profiled"
];
perOptDebugVariant = lib.genAttrs optDebugVariants (variant: let
reflex-platform = getRP { enableLibraryProfiling = variant == "profiled"; };
skeleton-test = import ./tests/skeleton.nix { inherit reflex-platform; };
otherDeps = getOtherDeps reflex-platform;
packages = {
# TODO uncomment this once GHCJS profiling builds are fixed
# tryReflexShell = reflex-platform.tryReflexShell;
ghc.ReflexTodomvc = reflex-platform.ghc.reflex-todomvc;
ghc8_6.reflexTodomvc = reflex-platform.ghc8_6.reflex-todomvc;
ghc8_10.reflexTodomvc = reflex-platform.ghc8_10.reflex-todomvc;
ghc.reflex-vty = reflex-platform.ghc.reflex-vty;
ghc.reflex-process = reflex-platform.ghc.reflex-process;
ghc.reflex-fsnotify = reflex-platform.ghc.reflex-fsnotify;
skeleton-test-ghc = skeleton-test.ghc;
} // lib.optionalAttrs (reflex-platform.androidSupport) {
inherit (reflex-platform) androidReflexTodomvc;
inherit (reflex-platform) androidReflexTodomvc-8_6;
inherit (reflex-platform) androidReflexTodomvc-8_10;
androidReflexTodomvc-release = reflex-platform.android.buildApp {
package = p: p.reflex-todomvc;
executableName = "reflex-todomvc";
applicationId = "org.reflexfrp.todomvc";
displayName = "Reflex TodoMVC";
isRelease = true;
};
skeleton-test-project-android = skeleton-test.project.android;
} // lib.optionalAttrs (reflex-platform.iosSupport) {
inherit (reflex-platform) iosReflexTodomvc;
inherit (reflex-platform) iosReflexTodomvc-8_6;
inherit (reflex-platform) iosReflexTodomvc-8_10;
inherit (reflex-platform) iosSimulatorReflexTodomvc;
skeleton-test-project-ios = skeleton-test.project.ios;
} // drvListToAttrs otherDeps
# TODO uncomment this once GHCJS profiling builds are fixed
# // drvListToAttrs (lib.filter lib.isDerivation reflex-platform.cachePackages)
;
in packages // {
cache = reflex-platform.pinBuildInputs "reflex-platform-${system}-${variant}"
(collect packages ++ otherDeps);
});
packages = {
inherit dep;
tryReflexShell = reflex-platform.tryReflexShell;
ghcjs.reflexTodomvc = jsexeHydra reflex-platform.ghcjs.reflex-todomvc;
# TODO Doesn't currently build. Removing from CI until fixed.
ghcjs8_6.reflexTodomvc = jsexeHydra reflex-platform.ghcjs8_6.reflex-todomvc;
ghcjs8_10.reflexTodomvc = jsexeHydra reflex-platform.ghcjs8_10.reflex-todomvc;
# TODO move back to `perOptDebugVariant`
skeleton-test-ghcjs = skeleton-test.ghcjs;
nojsstring = {
ghcjs.reflexTodomvc = reflex-platform-nojsstring.ghcjs.reflex-todomvc;
ghcjs8_6.reflexTodomvc = reflex-platform-nojsstring.ghcjs8_6.reflex-todomvc;
ghcjs8_10.reflexTodomvc = reflex-platform-nojsstring.ghcjs8_10.reflex-todomvc;
};
} // lib.optionalAttrs (system == "x86_64-linux") {
inherit
#benchmark
# demoVM # Skip for new due to rotted has in `breeze-icons`
;
} # TODO move back to `perOptDebugVariant`
// drvListToAttrs (lib.filter lib.isDerivation reflex-platform.cachePackages)
;
in packages // perOptDebugVariant // {
cache = reflex-platform.pinBuildInputs "reflex-platform-${system}"
(collect packages ++ map (a: a.cache) (builtins.attrValues perOptDebugVariant));
});
metaCache = local-self.pinBuildInputs "reflex-platform-everywhere"
(map (a: a.cache) (builtins.attrValues perPlatform));
in perPlatform // { inherit metaCache; }