@@ -1,10 +1,7 @@
11{ system ? builtins.currentSystem
22, profiling ? false
3−, iosSdkVersion ? "13.2"
3+, iosSdkVersion ? "10.2"
44, config ? {}
5−, terms ? { # Accepted terms, conditions, and licenses
6− security.acme.acceptTerms = false;
7− }
85, reflex-platform-func ? import ./dep/reflex-platform
96}:
107let
@@ -117,7 +114,7 @@ in rec {
117114 "${routeHost}".email = adminEmail;
118115 } else {};
119116
120− security.acme.${if enableHttps && (terms.security.acme.acceptTerms or false) then "acceptTerms" else null} = true;
117+ security.acme.${if enableHttps then "acceptTerms" else null} = true;
121118 };
122119
123120 mkObeliskApp =
@@ -134,16 +131,12 @@ in rec {
134131 }: {...}: {
135132 services.nginx = {
136133 enable = true;
137− recommendedProxySettings = true;
138134 virtualHosts."${routeHost}" = {
139135 enableACME = enableHttps;
140136 forceSSL = enableHttps;
141137 locations.${baseUrl} = {
142138 proxyPass = "http://127.0.0.1:" + toString internalPort;
143139 proxyWebsockets = true;
144− extraConfig = ''
145− access_log off;
146− '';
147140 };
148141 };
149142 };
@@ -186,9 +179,7 @@ in rec {
186179 set -eux
187180 ln -s '${if profiling then backend else haskellLib.justStaticExecutables backend}'/bin/* $out/
188181 ln -s '${mkAssets assets}' $out/static.assets
189− for d in '${mkAssets (compressedJs frontend optimizationLevel)}'/*/; do
190− ln -s "$d" "$out"/"$(basename "$d").assets"
191− done
182+ ln -s '${mkAssets (compressedJs frontend optimizationLevel)}'/* $out
192183 echo ${version} > $out/version
193184 '';
194185
@@ -337,40 +328,39 @@ in rec {
337328 });
338329 in allConfig;
339330 in (mkProject (projectDefinition args)).projectConfig);
340− mainProjectOut = projectOut { inherit system; };
331+ projectOutHost = projectOut { inherit system; };
341332 serverOn = projectInst: version: serverExe
342333 projectInst.ghc.backend
343− mainProjectOut.ghcjs.frontend
334+ projectOutHost.ghcjs.frontend
344335 projectInst.passthru.staticFiles
345336 projectInst.passthru.__closureCompilerOptimizationLevel
346337 version;
347− linuxExe = serverOn (projectOut { system = "x86_64-linux"; });
348338 dummyVersion = "Version number is only available for deployments";
349− in mainProjectOut // {
350− __unstable__.profiledObRun = let
351− profiled = projectOut { inherit system; enableLibraryProfiling = true; };
352− exeSource = builtins.toFile "ob-run.hs" ''
353− {-# LANGUAGE NoImplicitPrelude #-}
354− {-# LANGUAGE PackageImports #-}
355− module Main where
356−
357− -- Explicitly import Prelude from base lest there be multiple modules called Prelude
358− import "base" Prelude (IO, (++), read)
359−
360− import "base" Control.Exception (finally)
361− import "reflex" Reflex.Profiled (writeProfilingData)
362− import "base" System.Environment (getArgs)
363−
364− import qualified "obelisk-run" Obelisk.Run
365− import qualified Frontend
366− import qualified Backend
367−
368− main :: IO ()
369− main = do
370− [portStr, assets, profFileName] <- getArgs
371− Obelisk.Run.run (read portStr) (Obelisk.Run.runServeAsset assets) Backend.backend Frontend.frontend
372− `finally` writeProfilingData (profFileName ++ ".rprof")
373− '';
339+ profiledObRun =
340+ let
341+ profiled = projectOut { inherit system; enableLibraryProfiling = true; };
342+ exeSource = builtins.toFile "ob-run-profiled.hs" ''
343+ {-# LANGUAGE NoImplicitPrelude #-}
344+ {-# LANGUAGE PackageImports #-}
345+ module Main where
346+
347+ -- Explicitly import Prelude from base lest there be multiple modules called Prelude
348+ import "base" Prelude (IO, (++), read)
349+
350+ import "base" Control.Exception (finally)
351+ import "reflex" Reflex.Profiled (writeProfilingData)
352+ import "base" System.Environment (getArgs)
353+
354+ import qualified "obelisk-run" Obelisk.Run
355+ import qualified Frontend
356+ import qualified Backend
357+
358+ main :: IO ()
359+ main = do
360+ [portStr, assets, profFileName] <- getArgs
361+ Obelisk.Run.run (read portStr) (Obelisk.Run.runServeAsset assets) Backend.backend Frontend.frontend
362+ `finally` writeProfilingData (profFileName ++ ".rprof")
363+ '';
374364 in nixpkgs.runCommand "ob-run" {
375365 buildInputs = [ (profiled.ghc.ghcWithPackages (p: [p.backend p.frontend])) ];
376366 } ''
@@ -378,14 +368,16 @@ in rec {
378368 mkdir -p $out/bin
379369 ghc -x hs -prof -fno-prof-auto -threaded ob-run.hs -o $out/bin/ob-run
380370 '';
381−
382− linuxExeConfigurable = linuxExe;
383− linuxExe = linuxExe dummyVersion;
384− exe = serverOn mainProjectOut dummyVersion;
371+ in projectOutHost // lib.makeExtensible (self: {
372+ __unstable__.profiledObRun = profiledObRun;
373+ exeConfigurable = { system, version }: serverOn (projectOut { inherit system; }) version;
374+ exe = self.exeConfigurable { inherit system; version = dummyVersion; };
375+ linuxExeConfigurable = version: self.exeConfigurable { system = "x86_64-linux"; inherit version; };
376+ linuxExe = self.linuxExeConfigurable dummyVersion;
385377 server = args@{ hostName, adminEmail, routeHost, enableHttps, version, module ? serverModules.mkBaseEc2 }:
386− server (args // { exe = linuxExe version; });
378+ server (args // { exe = self.linuxExeConfigurable version; });
387379 obelisk = import (base' + "/.obelisk/impl") {};
388− };
380+ });
389381 haskellPackageSets = {
390382 inherit (reflex-platform) ghc ghcjs;
391383 };