From 72449617afe5766b474b239905498c61acb084e3 Mon Sep 17 00:00:00 2001 From: Florian Sesser Date: Thu, 6 Jun 2024 18:53:22 +0200 Subject: [PATCH] Some smallish fixes to the README --- README.md | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index af20c26..91067cd 100644 --- a/README.md +++ b/README.md @@ -4,25 +4,42 @@ Builds an obelisk frontend as a static library for use in an iOS project. Check ## Adding the dependency +```sh +mkdir dep +cd dep +nix-thunk create https://github.com/obsidiansystems/obelisk-ios-libfrontend.git +``` + Add this package to the [overrides](https://github.com/obsidiansystems/obelisk/#adding-package-overrides) in your obelisk project's default.nix: -``` -obelisk-ios-libfrontend = haskellLib.dontStrip (self.callCabal2nix "obelisk-ios-libfrontend" (hackGet ./dep/obelisk-ios-libfrontend + "/exe") {}); -obelisk-ios-libfrontendconfig = self.callCabal2nix "obelisk-ios-libfrontendconfig" (hackGet ./dep/obelisk-ios-libfrontend + "/lib") {}; +```nix +project ./. ({ pkgs, hackGet, ... }: { +... + +overrides = self: super: { + obelisk-ios-libfrontend = pkgs.haskell.lib.dontStrip (self.callCabal2nix "obelisk-ios-libfrontend" (hackGet ./dep/obelisk-ios-libfrontend + "/exe") {}); + obelisk-ios-libfrontendconfig = self.callCabal2nix "obelisk-ios-libfrontendconfig" (hackGet ./dep/obelisk-ios-libfrontend + "/lib") {}; +}; ``` Make sure to include `dontStrip`. ## Adding iOS config to your frontend code +Add `obelisk-ios-libfrontendconfig` to your frontend's `library`'s `build-depends` in `frontend/frontend.cabal`. + In your `frontend/Frontend.hs`, you'll need to add something like this: ```haskell ... -import Obelisk.Frontend.iOS +import Obelisk.Frontend.IOS ... +myHtmlHead = do + el "title" $ text "Obelisk Minimal Example" + elAttr "script" ("type" =: "application/javascript" <> "src" =: $(static "lib.js")) blank + elAttr "link" ("href" =: $(static "main.css") <> "type" =: "text/css" <> "rel" =: "stylesheet") blank iosConfig :: IO (IosConfig (R FrontendRoute)) iosConfig = do