on deprecated-optparse-function help sign in
obelisk/release.nix
97 lines 3.0 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}:
8let
9 inherit (local-self.nixpkgs) lib runCommand nix;
11 cacheBuildSystems = [ "x86_64-linux" "x86_64-darwin" ];
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 concatDepends = let
39 extractDeps = x: (x.override {
40 mkDerivation = drv: {
41 out = builtins.concatLists [
42 (drv.buildDepends or [])
43 (drv.libraryHaskellDepends or [])
44 (drv.executableHaskellDepends or [])
45 ];
46 };
47 }).out;
48 in pkgAttrs: builtins.concatLists (map extractDeps (builtins.attrValues pkgAttrs));
50 perPlatform = lib.genAttrs cacheBuildSystems (system: let
51 obelisk = import ./. (self-args // { inherit system; });
52 reflex-platform = obelisk.reflex-platform;
53 ghc = pnameToAttrs
54 obelisk.haskellPackageSets.ghc
55 obeliskPackagesBackend;
56 ghcjs = pnameToAttrs
57 obelisk.haskellPackageSets.ghcjs
58 obeliskPackagesCommon;
59 cachePackages = builtins.concatLists [
60 (builtins.attrValues ghc)
61 (builtins.attrValues ghcjs)
62 (concatDepends ghc)
63 (concatDepends ghcjs)
64 (lib.optional reflex-platform.androidSupport androidSkeleton)
65 (lib.optional reflex-platform.iosSupport iosSkeleton)
66 [ command serverSkeletonExe serverSkeletonShell ]
67 ];
68 command = obelisk.command;
69 skeleton = import ./skeleton { inherit obelisk; };
70 serverSkeletonExe = skeleton.exe;
71 # TODO fix nixpkgs so it doesn't try to run the result of haskell shells as setup hooks.
72 serverSkeletonShell = local-self.nixpkgs.runCommand "shell-safe-for-dep" {} ''
73 touch "$out"
74 echo "return" >> "$out"
75 cat "${skeleton.shells.ghc}" >> "$out"
76 '';
77 androidSkeleton = (import ./skeleton { inherit obelisk; }).android.frontend;
78 iosSkeleton = (import ./skeleton { inherit obelisk; }).ios.frontend;
79 in {
80 inherit
81 command
82 ghc ghcjs
83 serverSkeletonExe
84 serverSkeletonShell
85 ;
86 cache = reflex-platform.pinBuildInputs "obelisk-${system}" cachePackages;
87 } // lib.optionalAttrs reflex-platform.androidSupport {
88 inherit androidSkeleton;
89 } // lib.optionalAttrs reflex-platform.iosSupport {
90 inherit iosSkeleton;
91 });
93 metaCache = local-self.reflex-platform.pinBuildInputs
94 "obelisk-everywhere"
95 (map (a: a.cache) (builtins.attrValues perPlatform));
97in perPlatform // { inherit metaCache; }