on master help sign in
Merge remote-tracking branch 'origin/develop' into qa
commit41d710bfc6d4192a678c554b85273ac6398d33b8 authorElliot Cameron <eacameron@gmail.com> dateThu 23 Jan 2020, 17:49 (7 years ago) parentd5233733b15313
2 files changed+36−54
README.md−7 all-builds.nix+36−47
README.md−7
@@ -4,7 +4,6 @@ Obelisk provides an easy way to develop and deploy your [Reflex](https://github.
44
55- [Installing Obelisk](#installing-obelisk)
66- [Developing an Obelisk project](#developing-an-obelisk-project)
7− - [Hoogle](#hoogle)
87 - [Adding Packages](#adding-packages)
98 - [Adding Package Overrides](#adding-package-overrides)
109 - [Running over https](#running-over-https)
@@ -112,12 +111,6 @@ Firefox will not be able to properly run the development website due to [issue 4
112111
113112Every time you change the Haskell source files in frontend, common or backend, `ob run` will automatically recompile the modified files and reload the server. Furthermore, it will display on screen compilation errors and warnings if any.
114113
115−### Hoogle
116−
117−To enter a nix-shell from which you can run the hoogle command-line client or a hoogle server for your project:
118−
119−`nix-shell -A shells.ghc --arg withHoogle true`
120−
121114### Adding packages
122115
123116In order to add package dependencies, declare them under the build-depends field in the appropriate cabal files (backend, common, and frontend each have their own). The corresponding Nix packages will automatically be selected when building.
all-builds.nix+36−47
@@ -38,21 +38,16 @@ let
3838 (name: { inherit name; value = pkgsSet.${name}; })
3939 pnames);
4040
41− concatDepends = let
42− extractDeps = x: (x.override {
43− mkDerivation = drv: {
44− out = builtins.concatLists [
45− (drv.buildDepends or [])
46− (drv.libraryHaskellDepends or [])
47− (drv.executableHaskellDepends or [])
48− ];
49− };
50− }).out;
51− in pkgAttrs: builtins.concatLists (map extractDeps (builtins.attrValues pkgAttrs));
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 [];
5246
5347 perPlatform = lib.genAttrs cacheBuildSystems (system: let
5448 reflex-platform = import ./dep/reflex-platform { inherit system; };
55− perProfiling = profiling: let
49+
50+ mkPerProfiling = profiling: let
5651 obelisk = import ./. (self-args // { inherit system profiling; });
5752 ghc = pnameToAttrs
5853 obelisk.haskellPackageSets.ghc
@@ -60,19 +55,6 @@ let
6055 ghcjs = pnameToAttrs
6156 obelisk.haskellPackageSets.ghcjs
6257 obeliskPackagesCommon;
63− cachePackages = builtins.concatLists [
64− (builtins.attrValues ghc)
65− (lib.optionals (!profiling) (builtins.attrValues ghcjs))
66− (concatDepends ghc)
67− (lib.optionals (!profiling) (concatDepends ghcjs))
68− (lib.optional reflex-platform.androidSupport androidSkeleton)
69− (lib.optional reflex-platform.iosSupport iosSkeleton)
70− (lib.optionals (!profiling) [
71− command
72− serverSkeletonExe
73− serverSkeletonShell
74− ])
75− ];
7658 command = obelisk.command;
7759 skeleton = import ./skeleton { inherit obelisk; };
7860 serverSkeletonExe = skeleton.exe;
@@ -85,29 +67,36 @@ let
8567 androidSkeleton = (import ./skeleton { inherit obelisk; }).android.frontend;
8668 iosSkeleton = (import ./skeleton { inherit obelisk; }).ios.frontend;
8769 nameSuffix = if profiling then "profiled" else "unprofiled";
88− in {
89− inherit
90− ghc
91− ;
92− cache = reflex-platform.pinBuildInputs "obelisk-${system}-${nameSuffix}" cachePackages;
93− } // lib.optionalAttrs (!profiling) {
94− inherit
95− command
96− ghcjs
97− serverSkeletonExe
98− serverSkeletonShell
99− ;
100− } // lib.optionalAttrs reflex-platform.androidSupport {
101− inherit androidSkeleton;
102− } // lib.optionalAttrs reflex-platform.iosSupport {
103− inherit iosSkeleton;
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+ };
91+
92+ perProfiling = {
93+ profiled = mkPerProfiling true;
94+ unprofiled = mkPerProfiling false;
10495 };
105− profiled = perProfiling true;
106− unprofiled = perProfiling false;
107− cachePackages = map (p: p.cache) [ profiled unprofiled ];
108− in {
109− inherit profiled unprofiled;
110− cache = reflex-platform.pinBuildInputs "obelisk-${system}" cachePackages;
96+ in perProfiling // {
97+ cache = reflex-platform.pinBuildInputs
98+ "obelisk-${system}"
99+ (map (p: p.cache) (builtins.attrValues perProfiling));
111100 });
112101
113102 metaCache = local-self.reflex-platform.pinBuildInputs