on master help sign in
More asset fixes
commite279e99296227407d78312bd0f0240692e5fc9c3 authorRyan Trinkle <ryan.trinkle@gmail.com> dateSat 30 Jun 2018, 21:49 (8 years ago) parentbac03d7
1 file changed+12−9
default.nix+12−9
default.nix+12−9
@@ -5,8 +5,8 @@
55let
66 getReflexPlatform = sys: import ./dep/reflex-platform { inherit iosSdkVersion; system = sys; };
77 reflex-platform = getReflexPlatform system;
8− inherit (reflex-platform) hackGet;
9− pkgs = reflex-platform.nixpkgs;
8+ inherit (reflex-platform) hackGet nixpkgs;
9+ pkgs = nixpkgs;
1010in with pkgs.haskell.lib; with pkgs.lib;
1111let
1212 # TODO: Remove this after updating nixpkgs: https://github.com/NixOS/nixpkgs/issues/37750
@@ -125,6 +125,8 @@ let
125125 obelisk-snap-extras = self.callCabal2nix "obelisk-snap-extras" (cleanSource ./lib/snap-extras) {};
126126 };
127127
128+ inherit (import ./lib/asset/assets.nix { inherit nixpkgs; }) mkAssets;
129+
128130 defaultHaskellOverrides = composeExtensions fixUpstreamPkgs addLibs;
129131in
130132with pkgs.lib;
@@ -188,9 +190,9 @@ rec {
188190 mkdir $out
189191 set -eux
190192 ln -s "${justStaticExecutables backend}"/bin/backend $out/backend
191− ln -s "${assets}" $out/static.assets
193+ ln -s "${mkAssets assets}" $out/static.assets
192194 ln -s "${config}" $out/config
193− ln -s ${processAssets { src = compressedJs frontend; packageName = "frontend.jsexe"; moduleName = "FrontendJsexe"; }} $out/frontend.jsexe.assets
195+ ln -s ${mkAssets (compressedJs frontend)} $out/frontend.jsexe.assets
194196 ''; #TODO: run frontend.jsexe through the asset processing pipeline
195197
196198 server = { exe, hostName, adminEmail, routeHost, enableHttps }:
@@ -252,7 +254,8 @@ rec {
252254 # An Obelisk project is a reflex-platform project with a predefined layout and role for each component
253255 project = base: projectDefinition:
254256 let configPath = base + "/config";
255− assets = processAssets { src = base + "/static"; };
257+ static = base + "/static";
258+ processedStatic = processAssets { src = static; };
256259 projectOut = sys: (getReflexPlatform sys).project (args@{ nixpkgs, ... }:
257260 let mkProject = { android ? null #TODO: Better error when missing
258261 , ios ? null #TODO: Better error when missing
@@ -272,7 +275,7 @@ rec {
272275 };
273276 combinedPackages = predefinedPackages // packages;
274277 projectOverrides = self: super: {
275− ${staticName} = dontHaddock (self.callCabal2nix "static" assets.haskellManifest {});
278+ ${staticName} = dontHaddock (self.callCabal2nix "static" processedStatic.haskellManifest {});
276279 ${backendName} = addBuildDepend super.${backendName} self.obelisk-run;
277280 };
278281 totalOverrides = composeExtensions (composeExtensions defaultHaskellOverrides projectOverrides) overrides;
@@ -294,18 +297,18 @@ rec {
294297 android = {
295298 ${if android == null then null else frontendName} = {
296299 executableName = "frontend";
297− ${if builtins.pathExists staticPath then "assets" else null} = assets.symlinked;
300+ ${if builtins.pathExists staticPath then "assets" else null} = processedStatic.symlinked;
298301 } // android;
299302 };
300303 ios = {
301304 ${if ios == null then null else frontendName} = {
302305 executableName = "frontend";
303− ${if builtins.pathExists staticPath then "staticSrc" else null} = assets.symlinked;
306+ ${if builtins.pathExists staticPath then "staticSrc" else null} = processedStatic.symlinked;
304307 } // ios;
305308 };
306309 };
307310 in mkProject (projectDefinition args));
308− serverOn = sys: serverExe (projectOut sys).ghc.backend (projectOut system).ghcjs.frontend assets configPath;
311+ serverOn = sys: serverExe (projectOut sys).ghc.backend (projectOut system).ghcjs.frontend static configPath;
309312 linuxserver = serverOn "x86_64-linux";
310313 in projectOut system // {
311314 inherit linuxserver;