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