on master help sign in
Merge remote-tracking branch 'origin/master' into routes
commit674b8ffe71b34c54ff0702ef999d46ba41c04107 authorLuigy Leon <Luigy.Leon@Obsidian.Systems> dateThu 13 Sep 2018, 10:39 (8 years ago) parentd9589d77c7ebed
7 files changed+35−18
README.md+15−8 default.nix+4−2 lib/cliapp/src/Obelisk/CliApp/Logging.hs+2−2 lib/command/src/Obelisk/Command.hs+8−1 lib/executable-config/inject/obelisk-executable-config-inject.cabal+1−1 lib/executable-config/inject/src/Obelisk/ExecutableConfig/Inject.hs+1−1 lib/migration/src/Obelisk/Migration.hs+4−3
README.md+15−8
@@ -22,15 +22,22 @@ Obelisk provides an easy way to develop and deploy your [Reflex](https://github.
2222 ```
2323 1. If you are using another operating system or linux distribution, ensure that these lines are present in `/etc/nix/nix.conf`:
2424 ```
25− sandbox = true
2625 substituters = https://cache.nixos.org https://nixcache.reflex-frp.org
2726 trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI=
2827 ```
29− * If you are on MacOS, restart the nix daemon
30− ```
31− sudo launchctl stop org.nixos.nix-daemon
32− sudo launchctl start org.nixos.nix-daemon
33− ```
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+ ```
36+ then restart the nix daemon
37+ ```
38+ sudo launchctl stop org.nixos.nix-daemon
39+ sudo launchctl start org.nixos.nix-daemon
40+ ```
34411. Install obelisk: `nix-env -f https://github.com/obsidiansystems/obelisk/archive/master.tar.gz -iA command`
3542
3643### Contributing to Obelisk
@@ -145,7 +152,7 @@ cd ~/code/myapp-deploy
145152ob deploy push
146153```
147154
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`.
149156
150157At this point you are done. Your app will be accessible at `${ROUTE}`.
151158
@@ -259,7 +266,7 @@ First, if you do not already have a keystore, create it as follows (for more inf
259266nix-shell -p androidenv.platformTools --run "keytool -genkey -v -keystore myandroidkey.jks -keyalg RSA -keysize 2048 -validity 10000 -alias myandroidalias"
260267```
261268
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.)
263270
264271The `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.
265272
default.nix+4−2
@@ -21,7 +21,6 @@ let
2121 git
2222 gitAndTools.hub
2323 nix-prefetch-git
24− nixStable
2524 openssh
2625 ];
2726
@@ -253,6 +252,9 @@ rec {
253252 , ios ? null #TODO: Better error when missing
254253 , packages ? {}
255254 , overrides ? _: _: {}
255+ , tools ? _: []
256+ , shellToolOverrides ? _: _: {}
257+ , withHoogle ? false # Setting this to `true` makes shell reloading far slower
256258 }:
257259 let frontendName = "frontend";
258260 backendName = "backend";
@@ -272,6 +274,7 @@ rec {
272274 };
273275 totalOverrides = composeExtensions (composeExtensions defaultHaskellOverrides projectOverrides) overrides;
274276 in {
277+ inherit shellToolOverrides tools withHoogle;
275278 overrides = totalOverrides;
276279 packages = combinedPackages;
277280 shells = {
@@ -285,7 +288,6 @@ rec {
285288 commonName
286289 ];
287290 };
288− withHoogle = false; # Setting this to `true` makes shell reloading far slower
289291 android = {
290292 ${if android == null then null else frontendName} = {
291293 executableName = "frontend";
lib/cliapp/src/Obelisk/CliApp/Logging.hs+2−2
@@ -22,7 +22,7 @@ import Data.Semigroup ((<>))
2222import Data.Text (Text)
2323import qualified Data.Text as T
2424import 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),
2626 ConsoleIntensity (FaintIntensity), ConsoleLayer (Foreground),
2727 SGR (SetColor, SetConsoleIntensity), clearLine)
2828import System.Exit (ExitCode (..), exitWith)
@@ -146,7 +146,7 @@ writeLog withNewLine noColor (WithSeverity severity s)
146146 h = if severity <= Error then stderr else stdout
147147 errorColors = [SetColor Foreground Vivid Red]
148148 warningColors = [SetColor Foreground Vivid Yellow]
149− debugColors = [SetColor Foreground Vivid White, SetConsoleIntensity FaintIntensity]
149+ debugColors = [SetConsoleIntensity FaintIntensity]
150150
151151-- | Allow the user to immediately switch to verbose logging upon pressing a particular key.
152152--
lib/command/src/Obelisk/Command.hs+8−1
@@ -275,7 +275,14 @@ mkObeliskConfig = do
275275 isTerm <- hIsTerminalDevice stdout
276276 -- Running in bash/fish/zsh completion
277277 inShellCompletion <- liftIO $ isInfixOf "completion" . unwords <$> getArgs
278− return $ isTerm && not inShellCompletion
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+
285+ return $ isTerm && not inShellCompletion && not isDumb
279286
280287-- | For use from development obelisk repls
281288--
lib/executable-config/inject/obelisk-executable-config-inject.cabal+1−1
@@ -11,7 +11,7 @@ library
1111 bytestring,
1212 directory,
1313 filepath,
14− reflex-dom,
14+ reflex-dom-core,
1515 text
1616
1717 exposed-modules: Obelisk.ExecutableConfig.Inject
lib/executable-config/inject/src/Obelisk/ExecutableConfig/Inject.hs+1−1
@@ -8,7 +8,7 @@ import Data.ByteString (ByteString)
88import Data.Text (Text)
99import qualified Data.Text as T
1010import qualified Data.Text.IO as T
11−import Reflex.Dom hiding (value)
11+import Reflex.Dom.Core hiding (value)
1212import System.Directory
1313import System.FilePath ((</>))
1414
lib/migration/src/Obelisk/Migration.hs+4−3
@@ -17,6 +17,7 @@ import Data.Set (Set)
1717import qualified Data.Set as Set
1818import Data.Text (Text)
1919import qualified Data.Text as T
20+import qualified Data.Text.IO as T
2021import System.Directory
2122import System.FilePath
2223
@@ -46,10 +47,10 @@ data MigrationError
4647 deriving (Eq, Ord, Show)
4748
4849class Action action where
49− parseEdgeMeta :: String -> action
50+ parseEdgeMeta :: Text -> action
5051
5152instance Action Text where
52− parseEdgeMeta = T.pack
53+ parseEdgeMeta = id
5354
5455-- | Get the directed-acylic graph of migration
5556-- TODO: Consider calling getDag only when reading the graph for efficiency.
@@ -75,7 +76,7 @@ readGraph root name = doesDirectoryExist root >>= \case
7576 let f = root </> (T.unpack $ v1 <> "-" <> v2) </> T.unpack graph
7677 doesFileExist f >>= \case
7778 True -> do
78− c <- readFile f >>= pure . parseEdgeMeta
79+ c <- parseEdgeMeta <$> T.readFile f
7980 return $ Just c
8081 False -> do
8182 return Nothing