on eac@route-to-all.js help sign in
obelisk/all-builds.nix
106 lines 3.2 kB history raw
1{ self-args ? {
2 config.android_sdk.accept_license = true;
3 iosSdkVersion = "10.2";
4 }
5, local-self ? import ./. self-args
6, supportedSystems ? [
7 "x86_64-linux"
8 "x86_64-darwin"
9 ]
10}:
12let
13 inherit (local-self.nixpkgs) lib runCommand nix;
14 cacheBuildSystems = supportedSystems;
16 obeliskPackagesCommon = [
17 "obelisk-frontend"
18 "obelisk-route"
19 "obelisk-executable-config-lookup"
20 ];
22 obeliskPackagesBackend = obeliskPackagesCommon ++ [
23 "obelisk-asset-manifest"
24 "obelisk-asset-serve-snap"
25 "obelisk-backend"
26 "obelisk-cliapp"
27 "obelisk-command"
28 "obelisk-executable-config-inject"
29 "obelisk-frontend"
30 "obelisk-run"
31 "obelisk-route"
32 "obelisk-selftest"
33 "obelisk-snap-extras"
34 ];
36 pnameToAttrs = pkgsSet: pnames:
37 lib.listToAttrs (map
38 (name: { inherit name; value = pkgsSet.${name}; })
39 pnames);
41 collect = v:
42 if lib.isDerivation v then [v]
43 else if lib.isAttrs v then lib.concatMap collect (builtins.attrValues v)
44 else if lib.isList v then lib.concatMap collect v
45 else [];
47 perPlatform = lib.genAttrs cacheBuildSystems (system: let
48 reflex-platform = import ./dep/reflex-platform { inherit system; };
50 mkPerProfiling = profiling: let
51 obelisk = import ./. (self-args // { inherit system profiling; });
52 ghc = pnameToAttrs
53 obelisk.haskellPackageSets.ghc
54 obeliskPackagesBackend;
55 ghcjs = pnameToAttrs
56 obelisk.haskellPackageSets.ghcjs
57 obeliskPackagesCommon;
58 command = obelisk.command;
59 skeleton = import ./skeleton { inherit obelisk; };
60 serverSkeletonExe = skeleton.exe;
61 # TODO fix nixpkgs so it doesn't try to run the result of haskell shells as setup hooks.
62 serverSkeletonShell = local-self.nixpkgs.runCommand "shell-safe-for-dep" {} ''
63 touch "$out"
64 echo "return" >> "$out"
65 cat "${skeleton.shells.ghc}" >> "$out"
66 '';
67 androidSkeleton = (import ./skeleton { inherit obelisk; }).android.frontend;
68 iosSkeleton = (import ./skeleton { inherit obelisk; }).ios.frontend;
69 nameSuffix = if profiling then "profiled" else "unprofiled";
70 packages = {
71 inherit
72 command
73 serverSkeletonShell
74 ghc
75 ;
76 } // lib.optionalAttrs (!profiling) {
77 inherit
78 ghcjs
79 serverSkeletonExe
80 ;
81 } // lib.optionalAttrs reflex-platform.androidSupport {
82 inherit androidSkeleton;
83 } // lib.optionalAttrs reflex-platform.iosSupport {
84 inherit iosSkeleton;
85 };
86 in packages // {
87 cache = reflex-platform.pinBuildInputs
88 "obelisk-${system}-${nameSuffix}"
89 (collect packages);
90 };
92 perProfiling = {
93 profiled = mkPerProfiling true;
94 unprofiled = mkPerProfiling false;
95 };
96 in perProfiling // {
97 cache = reflex-platform.pinBuildInputs
98 "obelisk-${system}"
99 (map (p: p.cache) (builtins.attrValues perProfiling));
100 });
102 metaCache = local-self.reflex-platform.pinBuildInputs
103 "obelisk-everywhere"
104 (map (a: a.cache) (builtins.attrValues perPlatform));
106in perPlatform // { inherit metaCache; }