on master help sign in
Merge remote-tracking branch 'origin/master' into routes
674b8ffLuigy Leon
README.md+15−8
@@ -22,15 +22,22 @@ Obelisk provides an easy way to develop and deploy your [Reflex](https://github.
22 ```
22 ```
23 1. If you are using another operating system or linux distribution, ensure that these lines are present in `/etc/nix/nix.conf`:
23 1. If you are using another operating system or linux distribution, ensure that these lines are present in `/etc/nix/nix.conf`:
24 ```
24 ```
25− sandbox = true
26 substituters = https://cache.nixos.org https://nixcache.reflex-frp.org
25 substituters = https://cache.nixos.org https://nixcache.reflex-frp.org
27 trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI=
26 trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI=
28 ```
27 ```
28+ * other Linux: enable sandboxing (see https://github.com/obsidiansystems/obelisk/issues/6)
29+ ```
30+ sandbox = true
31+ ```
32+ * MacOS: disable sandboxing (there are still some impure dependencies for now)
33+ ```
34+ sandbox = false
35+ ```
29− * If you are on MacOS, restart the nix daemon
36+ then restart the nix daemon
30− ```
37+ ```
31− sudo launchctl stop org.nixos.nix-daemon
38+ sudo launchctl stop org.nixos.nix-daemon
32− sudo launchctl start org.nixos.nix-daemon
39+ sudo launchctl start org.nixos.nix-daemon
33− ```
40+ ```
341. Install obelisk: `nix-env -f https://github.com/obsidiansystems/obelisk/archive/master.tar.gz -iA command`
411. Install obelisk: `nix-env -f https://github.com/obsidiansystems/obelisk/archive/master.tar.gz -iA command`
35
42
36### Contributing to Obelisk
43### Contributing to Obelisk
@@ -145,7 +152,7 @@ cd ~/code/myapp-deploy
145ob deploy push
152ob deploy push
146```
153```
147
154
148−`ob deploy push` will locally build your app and then transfer it, along with all the Nix package dependencies, via ssh to the EC2 instance.
155+`ob deploy push` will locally build your app and then transfer it, along with all the Nix package dependencies, via ssh to the EC2 instance. The backend will live in `/var/lib/backend`.
149
156
150At this point you are done. Your app will be accessible at `${ROUTE}`.
157At this point you are done. Your app will be accessible at `${ROUTE}`.
151
158
@@ -259,7 +266,7 @@ First, if you do not already have a keystore, create it as follows (for more inf
259nix-shell -p androidenv.platformTools --run "keytool -genkey -v -keystore myandroidkey.jks -keyalg RSA -keysize 2048 -validity 10000 -alias myandroidalias"
266nix-shell -p androidenv.platformTools --run "keytool -genkey -v -keystore myandroidkey.jks -keyalg RSA -keysize 2048 -validity 10000 -alias myandroidalias"
260```
267```
261
268
262−(Besure to give an appropriate keystore filename and key alias string above.)
269+(Be sure to give an appropriate keystore filename and key alias string above.)
263
270
264The `keytool` command will ask you for some details, including a keystore password and a key password (we will use these passwords further below). It will now have created a `myandroidkey.jks` file under the current directory. Move that to somewhere safe, and note down its full path.
271The `keytool` command will ask you for some details, including a keystore password and a key password (we will use these passwords further below). It will now have created a `myandroidkey.jks` file under the current directory. Move that to somewhere safe, and note down its full path.
265
272
default.nix+4−2
@@ -21,7 +21,6 @@ let
21 git
21 git
22 gitAndTools.hub
22 gitAndTools.hub
23 nix-prefetch-git
23 nix-prefetch-git
24− nixStable
25 openssh
24 openssh
26 ];
25 ];
27
26
@@ -253,6 +252,9 @@ rec {
253 , ios ? null #TODO: Better error when missing
252 , ios ? null #TODO: Better error when missing
254 , packages ? {}
253 , packages ? {}
255 , overrides ? _: _: {}
254 , overrides ? _: _: {}
255+ , tools ? _: []
256+ , shellToolOverrides ? _: _: {}
257+ , withHoogle ? false # Setting this to `true` makes shell reloading far slower
256 }:
258 }:
257 let frontendName = "frontend";
259 let frontendName = "frontend";
258 backendName = "backend";
260 backendName = "backend";
@@ -272,6 +274,7 @@ rec {
272 };
274 };
273 totalOverrides = composeExtensions (composeExtensions defaultHaskellOverrides projectOverrides) overrides;
275 totalOverrides = composeExtensions (composeExtensions defaultHaskellOverrides projectOverrides) overrides;
274 in {
276 in {
277+ inherit shellToolOverrides tools withHoogle;
275 overrides = totalOverrides;
278 overrides = totalOverrides;
276 packages = combinedPackages;
279 packages = combinedPackages;
277 shells = {
280 shells = {
@@ -285,7 +288,6 @@ rec {
285 commonName
288 commonName
286 ];
289 ];
287 };
290 };
288− withHoogle = false; # Setting this to `true` makes shell reloading far slower
289 android = {
291 android = {
290 ${if android == null then null else frontendName} = {
292 ${if android == null then null else frontendName} = {
291 executableName = "frontend";
293 executableName = "frontend";
lib/cliapp/src/Obelisk/CliApp/Logging.hs+2−2
@@ -22,7 +22,7 @@ import Data.Semigroup ((<>))
22import Data.Text (Text)
22import Data.Text (Text)
23import qualified Data.Text as T
23import qualified Data.Text as T
24import qualified Data.Text.IO as T
24import qualified Data.Text.IO as T
25−import System.Console.ANSI (Color (Red, White, Yellow), ColorIntensity (Vivid),
25+import System.Console.ANSI (Color (Red, Yellow), ColorIntensity (Vivid),
26 ConsoleIntensity (FaintIntensity), ConsoleLayer (Foreground),
26 ConsoleIntensity (FaintIntensity), ConsoleLayer (Foreground),
27 SGR (SetColor, SetConsoleIntensity), clearLine)
27 SGR (SetColor, SetConsoleIntensity), clearLine)
28import System.Exit (ExitCode (..), exitWith)
28import System.Exit (ExitCode (..), exitWith)
@@ -146,7 +146,7 @@ writeLog withNewLine noColor (WithSeverity severity s)
146 h = if severity <= Error then stderr else stdout
146 h = if severity <= Error then stderr else stdout
147 errorColors = [SetColor Foreground Vivid Red]
147 errorColors = [SetColor Foreground Vivid Red]
148 warningColors = [SetColor Foreground Vivid Yellow]
148 warningColors = [SetColor Foreground Vivid Yellow]
149− debugColors = [SetColor Foreground Vivid White, SetConsoleIntensity FaintIntensity]
149+ debugColors = [SetConsoleIntensity FaintIntensity]
150
150
151-- | Allow the user to immediately switch to verbose logging upon pressing a particular key.
151-- | Allow the user to immediately switch to verbose logging upon pressing a particular key.
152--
152--
lib/command/src/Obelisk/Command.hs+8−1
@@ -275,7 +275,14 @@ mkObeliskConfig = do
275 isTerm <- hIsTerminalDevice stdout
275 isTerm <- hIsTerminalDevice stdout
276 -- Running in bash/fish/zsh completion
276 -- Running in bash/fish/zsh completion
277 inShellCompletion <- liftIO $ isInfixOf "completion" . unwords <$> getArgs
277 inShellCompletion <- liftIO $ isInfixOf "completion" . unwords <$> getArgs
278+
279+ -- Respect the user’s TERM environment variable. Dumb terminals
280+ -- like Eshell cannot handle lots of control sequences that the
281+ -- spinner uses.
282+ termEnv <- lookupEnv "TERM"
283+ let isDumb = termEnv == Just "dumb"
284+
278− return $ isTerm && not inShellCompletion
285+ return $ isTerm && not inShellCompletion && not isDumb
279
286
280-- | For use from development obelisk repls
287-- | For use from development obelisk repls
281--
288--
lib/executable-config/inject/obelisk-executable-config-inject.cabal+1−1
@@ -11,7 +11,7 @@ library
11 bytestring,
11 bytestring,
12 directory,
12 directory,
13 filepath,
13 filepath,
14− reflex-dom,
14+ reflex-dom-core,
15 text
15 text
16
16
17 exposed-modules: Obelisk.ExecutableConfig.Inject
17 exposed-modules: Obelisk.ExecutableConfig.Inject
lib/executable-config/inject/src/Obelisk/ExecutableConfig/Inject.hs+1−1
@@ -8,7 +8,7 @@ import Data.ByteString (ByteString)
8import Data.Text (Text)
8import Data.Text (Text)
9import qualified Data.Text as T
9import qualified Data.Text as T
10import qualified Data.Text.IO as T
10import qualified Data.Text.IO as T
11−import Reflex.Dom hiding (value)
11+import Reflex.Dom.Core hiding (value)
12import System.Directory
12import System.Directory
13import System.FilePath ((</>))
13import System.FilePath ((</>))
14
14
lib/migration/src/Obelisk/Migration.hs+4−3
@@ -17,6 +17,7 @@ import Data.Set (Set)
17import qualified Data.Set as Set
17import qualified Data.Set as Set
18import Data.Text (Text)
18import Data.Text (Text)
19import qualified Data.Text as T
19import qualified Data.Text as T
20+import qualified Data.Text.IO as T
20import System.Directory
21import System.Directory
21import System.FilePath
22import System.FilePath
22
23
@@ -46,10 +47,10 @@ data MigrationError
46 deriving (Eq, Ord, Show)
47 deriving (Eq, Ord, Show)
47
48
48class Action action where
49class Action action where
49− parseEdgeMeta :: String -> action
50+ parseEdgeMeta :: Text -> action
50
51
51instance Action Text where
52instance Action Text where
52− parseEdgeMeta = T.pack
53+ parseEdgeMeta = id
53
54
54-- | Get the directed-acylic graph of migration
55-- | Get the directed-acylic graph of migration
55-- TODO: Consider calling getDag only when reading the graph for efficiency.
56-- TODO: Consider calling getDag only when reading the graph for efficiency.
@@ -75,7 +76,7 @@ readGraph root name = doesDirectoryExist root >>= \case
75 let f = root </> (T.unpack $ v1 <> "-" <> v2) </> T.unpack graph
76 let f = root </> (T.unpack $ v1 <> "-" <> v2) </> T.unpack graph
76 doesFileExist f >>= \case
77 doesFileExist f >>= \case
77 True -> do
78 True -> do
78− c <- readFile f >>= pure . parseEdgeMeta
79+ c <- parseEdgeMeta <$> T.readFile f
79 return $ Just c
80 return $ Just c
80 False -> do
81 False -> do
81 return Nothing
82 return Nothing