on master help sign in
Merge branch 'develop' into ts-fix-exe-config
commit2471e7a9e803595d483c1f7a975884e53b989e9d authorAli Abrar <aliabrar@gmail.com> dateWed 14 Aug 2019, 16:49 (7 years ago) parent13ec444c8d2128
8 files changed+29−13
CONTRIBUTING.md+5 ChangeLog.md+1 README.md+5 default.nix+1−1 lib/command/src/Obelisk/Command/Run.hs+4−1 lib/command/src/Obelisk/Command/VmBuilder.hs+2−1 lib/route/src/Obelisk/Route.hs+1−1 lib/selftest/src/Obelisk/SelfTest.hs+10−9
CONTRIBUTING.md+5
@@ -5,6 +5,7 @@ Contributions and issue reports are encouraged and appreciated!
55- [Opening Issues](#opening-issues)
66- [Submitting Changes](#submitting-changes)
77 - [Guidelines for Commit Messages](#guidelines-for-commit-messages)
8+ - [Guidelines for Pull Requests](#guidelines-for-pull-requests)
89 - [Code Quality](#code-quality)
910 - [Documentation](#documentation)
1011
@@ -34,6 +35,10 @@ Commits that update a dependency should include some information about why the d
3435#### Body
3536For breaking changes, new features, refactors, or other major changes, the body of the commit message should describe the motivation behind the change in greater detail and may include references to the issue tracker. The body shouldn't repeat code/comments from the diff.
3637
38+### Guidelines for Pull Requests
39+
40+Wherever possible, pull requests should add a single feature or fix a single bug. Pull requests should not bundle several unrelated changes.
41+
3742### Code Quality
3843
3944#### Warnings
ChangeLog.md+1
@@ -9,6 +9,7 @@ This project's release branch is `master`. This log is written from the perspect
99* The backend no longer runs in BackendConfigsT.
1010* Add tabulation package. See Data.Tabulation for details.
1111* Add encoders for `DMap`, `HasFields` (cf. Data.Tabulation), and JSON.
12+* Use IP address for nginx proxy pass instead of localhost
1213
1314## v0.1.1.0 - 2019-05-17
1415
README.md+5
@@ -5,6 +5,7 @@ Obelisk provides an easy way to develop and deploy your [Reflex](https://github.
55- [Installing Obelisk](#installing-obelisk)
66- [Developing an Obelisk project](#developing-an-obelisk-project)
77 - [Hoogle](#hoogle)
8+ - [Adding Packages](#adding-packages)
89 - [Adding Package Overrides](#adding-package-overrides)
910- [Deploying](#deploying)
1011 - [Locally](#locally)
@@ -92,6 +93,10 @@ To enter a nix-shell from which you can run the hoogle command-line client or a
9293
9394`nix-shell -A shells.ghc --arg withHoogle true`
9495
96+### Adding packages
97+
98+In order to add package dependencies, declare them under the build-depends field in the appropriate cabal files (backend, common, and frontend each have their own). The corresponding Nix packages will automatically be selected when building.
99+
95100### Adding package overrides
96101
97102To add a version override to any Haskell package, or to add a Haskell package that doesn't exist in the nixpkgs used by Obelisk, use the `overrides` attribute in your project's `default.nix`. For example, to use a specific version of the `aeson` package, your `default.nix` will look like:
default.nix+1−1
@@ -198,7 +198,7 @@ in rec {
198198 enableACME = enableHttps;
199199 forceSSL = enableHttps;
200200 locations.${baseUrl} = {
201− proxyPass = "http://localhost:" + toString internalPort;
201+ proxyPass = "http://127.0.0.1:" + toString internalPort;
202202 proxyWebsockets = true;
203203 };
204204 };
lib/command/src/Obelisk/Command/Run.hs+4−1
@@ -73,7 +73,10 @@ run = do
7373 -- Check whether the impure static files are a derivation (and so must be built)
7474 if isDerivation == "1"
7575 then fmap T.strip $ readProcessAndLogStderr Debug $ -- Strip whitespace here because nix-build has no --raw option
76− proc "nix-build" ["-E", "(import " <> importableRoot <> "{}).passthru.staticFilesImpure"]
76+ proc "nix-build"
77+ [ "--no-out-link"
78+ , "-E", "(import " <> importableRoot <> "{}).passthru.staticFilesImpure"
79+ ]
7780 else readProcessAndLogStderr Debug $
7881 proc "nix" ["eval", "-f", root, "passthru.staticFilesImpure", "--raw"]
7982 putLog Debug $ "Assets impurely loaded from: " <> assets
lib/command/src/Obelisk/Command/VmBuilder.hs+2−1
@@ -156,7 +156,8 @@ testLinuxBuild stateDir
156156 | System.Info.os == "linux" = failWith "Using the docker builder is not necessary on linux."
157157 | otherwise = do
158158 (exitCode, _stdout, stderr) <- readCreateProcessWithExitCode $ proc "nix-build"
159− [ "-E", "(import <nixpkgs> { system = \"x86_64-linux\"; }).writeText \"test\" builtins.currentTime"
159+ [ "--no-out-link"
160+ , "-E", "(import <nixpkgs> { system = \"x86_64-linux\"; }).writeText \"test\" builtins.currentTime"
160161 , "--builders", nixBuildersArgString stateDir
161162 ]
162163 unless (exitCode == ExitSuccess) $ do
lib/route/src/Obelisk/Route.hs+1−1
@@ -202,7 +202,7 @@ decode e x = runIdentity (tryDecode e x)
202202tryDecode :: Encoder Identity parse decoded encoded -> encoded -> parse decoded
203203tryDecode (Encoder (Identity impl)) x = _encoderImpl_decode impl x
204204
205−-- | Similar to 'decode' above, once an encoder has been checked so that its check monad is Identity, it
205+-- | Similar to 'decode', once an encoder has been checked so that its check monad is Identity, it
206206-- can be used to actually encode by using this. Note that while there's no constraint on the parse monad here,
207207-- one should usually be applying decode and encode to the same 'Encoder'
208208encode :: Encoder Identity parse decoded encoded -> decoded -> encoded
lib/selftest/src/Obelisk/SelfTest.hs+10−9
@@ -75,6 +75,7 @@ main = do
7575 unless isVerbose $
7676 putStrLn "Tests may take longer to run if there are unbuilt derivations: use -v for verbose output"
7777 let verbosity = bool silently verbosely isVerbose
78+ nixBuild args = run "nix-build" ("--no-out-link" : args)
7879 obeliskImpl <- fromString <$> getEnv "OBELISK_IMPL"
7980 httpManager <- HTTP.newManager HTTP.defaultManagerSettings
8081 [p0, p1, p2, p3] <- liftIO $ getFreePorts 4
@@ -141,22 +142,22 @@ main = do
141142 testObRunInDir p2 p3 (Just "frontend") httpManager
142143
143144 describe "obelisk project" $ parallel $ do
144− it "can build obelisk command" $ inTmpObInit $ \_ -> run "nix-build" ["-A", "command" , obeliskImpl]
145− it "can build obelisk skeleton" $ inTmpObInit $ \_ -> run "nix-build" ["-A", "skeleton", obeliskImpl]
146− it "can build obelisk shell" $ inTmpObInit $ \_ -> run "nix-build" ["-A", "shell", obeliskImpl]
145+ it "can build obelisk command" $ inTmpObInit $ \_ -> nixBuild ["-A", "command" , obeliskImpl]
146+ it "can build obelisk skeleton" $ inTmpObInit $ \_ -> nixBuild ["-A", "skeleton", obeliskImpl]
147+ it "can build obelisk shell" $ inTmpObInit $ \_ -> nixBuild ["-A", "shell", obeliskImpl]
147148 -- See https://github.com/obsidiansystems/obelisk/issues/101
148− -- it "can build everything" $ shelly_ $ run "nix-build" [obeliskImpl]
149+ -- it "can build everything" $ shelly_ $ nixBuild [obeliskImpl]
149150
150151 describe "blank initialized project" $ parallel $ do
151152
152153 it "can build ghc.backend" $ inTmpObInit $ \_ -> do
153− run "nix-build" ["--no-out-link", "-A", "ghc.backend"]
154+ nixBuild ["-A", "ghc.backend"]
154155 it "can build ghcjs.frontend" $ inTmpObInit $ \_ -> do
155− run "nix-build" ["--no-out-link", "-A", "ghcjs.frontend"]
156+ nixBuild ["-A", "ghcjs.frontend"]
156157
157158 if os == "darwin"
158− then it "can build ios" $ inTmpObInit $ \_ -> run "nix-build" ["--no-out-link", "-A", "ios.frontend" ]
159− else it "can build android" $ inTmpObInit $ \_ -> run "nix-build" ["--no-out-link", "-A", "android.frontend"]
159+ then it "can build ios" $ inTmpObInit $ \_ -> nixBuild ["-A", "ios.frontend"]
160+ else it "can build android" $ inTmpObInit $ \_ -> nixBuild ["-A", "android.frontend"]
160161
161162 forM_ ["ghc", "ghcjs"] $ \compiler -> do
162163 let
@@ -166,7 +167,7 @@ main = do
166167 it ("can build in " <> shell) $ inTmpObInit $ \_ -> inShell $ "cabal new-build --" <> fromString compiler <> " all"
167168
168169 it "can build reflex project" $ inTmpObInit $ \_ -> do
169− run "nix-build" []
170+ nixBuild []
170171
171172 it "has idempotent thunk update" $ inTmpObInit $ \_ -> do
172173 u <- update