@@ -1,6 +1,6 @@
11{ system ? builtins.currentSystem
22, profiling ? false
3−, iosSdkVersion ? "10.2"
3+, iosSdkVersion ? "13.2"
44, config ? {}
55, reflex-platform-func ? import ./dep/reflex-platform
66}:
@@ -131,6 +131,7 @@ in rec {
131131 }: {...}: {
132132 services.nginx = {
133133 enable = true;
134+ recommendedProxySettings = true;
134135 virtualHosts."${routeHost}" = {
135136 enableACME = enableHttps;
136137 forceSSL = enableHttps;
@@ -256,16 +257,22 @@ in rec {
256257 ${self.backendName} = haskellLib.addBuildDepend super'.${self.backendName} self'.obelisk-run;
257258 };
258259 totalOverrides = lib.composeExtensions self.projectOverrides self.userSettings.overrides;
259− privateConfigDirs = ["config/backend"];
260− injectableConfig = builtins.filterSource (path: _:
261− !(lib.lists.any (x: hasPrefix (toString self.base + "/" + toString x) (toString path)) self.privateConfigDirs)
260+
261+
262+ allowedConfigDirs = ["config/backend" "config/common" "config/frontend"];
263+ nonPrivateConfigDirs = ["config/common" "config/frontend"];
264+ injectableConfig = base: builtins.filterSource (path: _:
265+ let pathIsInAny = lib.lists.any (x: hasPrefix (toString base + "/" + toString x) (toString path));
266+ in if !pathIsInAny self.allowedConfigDirs
267+ then throw "Path is not in a valid config directory ${path}. Valid config directories are: ${lib.concatStringsSep ", " self.allowedConfigDirs}"
268+ else pathIsInAny self.nonPrivateConfigDirs
262269 );
263270 __androidWithConfig = configPath: {
264271 ${if self.userSettings.android == null then null else self.frontendName} = {
265272 executableName = "frontend";
266273 ${if builtins.pathExists self.userSettings.staticFiles then "assets" else null} =
267274 nixpkgs.obeliskExecutableConfig.platforms.android.inject
268− (self.injectableConfig configPath)
275+ (self.injectableConfig (builtins.dirOf configPath) configPath)
269276 self.processedStatic.symlinked;
270277 } // self.userSettings.android;
271278 };
@@ -274,7 +281,7 @@ in rec {
274281 executableName = "frontend";
275282 ${if builtins.pathExists self.userSettings.staticFiles then "staticSrc" else null} =
276283 nixpkgs.obeliskExecutableConfig.platforms.ios.inject
277− (self.injectableConfig configPath)
284+ (self.injectableConfig (builtins.dirOf configPath) configPath)
278285 self.processedStatic.symlinked;
279286 } // self.userSettings.ios;
280287 };
@@ -328,40 +335,39 @@ in rec {
328335 });
329336 in allConfig;
330337 in (mkProject (projectDefinition args)).projectConfig);
331− mainProjectOut = projectOut { inherit system; };
338+ projectOutHost = projectOut { inherit system; };
332339 serverOn = projectInst: version: serverExe
333340 projectInst.ghc.backend
334− mainProjectOut.ghcjs.frontend
341+ projectOutHost.ghcjs.frontend
335342 projectInst.passthru.staticFiles
336343 projectInst.passthru.__closureCompilerOptimizationLevel
337344 version;
338− linuxExe = serverOn (projectOut { system = "x86_64-linux"; });
339345 dummyVersion = "Version number is only available for deployments";
340− in mainProjectOut // {
341− __unstable__.profiledObRun = let
342− profiled = projectOut { inherit system; enableLibraryProfiling = true; };
343− exeSource = builtins.toFile "ob-run.hs" ''
344− {-# LANGUAGE NoImplicitPrelude #-}
345− {-# LANGUAGE PackageImports #-}
346− module Main where
347−
348− -- Explicitly import Prelude from base lest there be multiple modules called Prelude
349− import "base" Prelude (IO, (++), read)
350−
351− import "base" Control.Exception (finally)
352− import "reflex" Reflex.Profiled (writeProfilingData)
353− import "base" System.Environment (getArgs)
354−
355− import qualified "obelisk-run" Obelisk.Run
356− import qualified Frontend
357− import qualified Backend
358−
359− main :: IO ()
360− main = do
361− [portStr, assets, profFileName] <- getArgs
362− Obelisk.Run.run (read portStr) (Obelisk.Run.runServeAsset assets) Backend.backend Frontend.frontend
363− `finally` writeProfilingData (profFileName ++ ".rprof")
364− '';
346+ profiledObRun =
347+ let
348+ profiled = projectOut { inherit system; enableLibraryProfiling = true; };
349+ exeSource = builtins.toFile "ob-run-profiled.hs" ''
350+ {-# LANGUAGE NoImplicitPrelude #-}
351+ {-# LANGUAGE PackageImports #-}
352+ module Main where
353+
354+ -- Explicitly import Prelude from base lest there be multiple modules called Prelude
355+ import "base" Prelude (IO, (++), read)
356+
357+ import "base" Control.Exception (finally)
358+ import "reflex" Reflex.Profiled (writeProfilingData)
359+ import "base" System.Environment (getArgs)
360+
361+ import qualified "obelisk-run" Obelisk.Run
362+ import qualified Frontend
363+ import qualified Backend
364+
365+ main :: IO ()
366+ main = do
367+ [portStr, assets, profFileName] <- getArgs
368+ Obelisk.Run.run (read portStr) (Obelisk.Run.runServeAsset assets) Backend.backend Frontend.frontend
369+ `finally` writeProfilingData (profFileName ++ ".rprof")
370+ '';
365371 in nixpkgs.runCommand "ob-run" {
366372 buildInputs = [ (profiled.ghc.ghcWithPackages (p: [p.backend p.frontend])) ];
367373 } ''
@@ -369,14 +375,16 @@ in rec {
369375 mkdir -p $out/bin
370376 ghc -x hs -prof -fno-prof-auto -threaded ob-run.hs -o $out/bin/ob-run
371377 '';
372−
373− linuxExeConfigurable = linuxExe;
374− linuxExe = linuxExe dummyVersion;
375− exe = serverOn mainProjectOut dummyVersion;
378+ in projectOutHost // lib.makeExtensible (self: {
379+ __unstable__.profiledObRun = profiledObRun;
380+ exeConfigurable = { system, version }: serverOn (projectOut { inherit system; }) version;
381+ exe = self.exeConfigurable { inherit system; version = dummyVersion; };
382+ linuxExeConfigurable = version: self.exeConfigurable { system = "x86_64-linux"; inherit version; };
383+ linuxExe = self.linuxExeConfigurable dummyVersion;
376384 server = args@{ hostName, adminEmail, routeHost, enableHttps, version, module ? serverModules.mkBaseEc2 }:
377− server (args // { exe = linuxExe version; });
385+ server (args // { exe = self.linuxExeConfigurable version; });
378386 obelisk = import (base' + "/.obelisk/impl") {};
379− };
387+ });
380388 haskellPackageSets = {
381389 inherit (reflex-platform) ghc ghcjs;
382390 };