Skip to content
generated from srid/ema-template

Theoretically optimal distribution of aid for flood-stricken Pakistan (2022)

License

Notifications You must be signed in to change notification settings

faezs/astaghfirullah

Repository files navigation

Ema Template

A very simple example Ema site that is based on Blaze HTML & TailwindCSS 3. Use it to bootstrap your next static site using Ema.

The generated HTML site can be previewed here: https://emaapps.github.io/astaghfirullah/

Getting Started

To develop with full IDE support in Visual Studio Code, follow these steps:

  • Install Nix & enable Flakes
  • Setup the garnix cache (Nix binary cache), unless you are okay with compiling for hours.
  • Run nix develop -i -c haskell-language-server to sanity check your environment
  • Open the repository as single-folder workspace in Visual Studio Code
    • Install the recommended extensions
    • Ctrl+Shift+P to run the command "Nix-Env: Select Environment" and select shell.nix. The extension will ask you to reload VSCode at the end.
  • Press Ctrl+Shift+B in VSCode, or run bin/run in terminal, to launch the Ema dev server, and navigate to http://localhost:9001/

All but the final step need to be done only once. Check the Ema tutorial next.

Note

  • We are using GHC 9.2 which is not yet the default in nixpkgs, so you may want to use the garnix cache to avoid long compilation.
  • This project uses relude as its prelude, as well as Tailwind+Blaze as CSS utility and HTML DSL. Even though the author highly recommends them, you are of course free to swap them out for the library of your choice.
    • Tailwind CSS is compiled, alongside Ghcid, via foreman (see ./Procfile)
  • As a first step to using this template,
    • change the project name in .cabal, flake.nix and hie.yaml files; then commit changes to Git.
      • To automate this, mv astaghfirullah.cabal myproject.cabal; nix run nixpkgs#sd -- astaghfirullah myproject * */* .github/*/*
  • Configuration:
    • To change the port (or the Ema CLI arguments, used by bin/run), see ./.ghcid (if you leave out --port a random port will be used)
    • To update Ema to the latest Git revision, run nix flake lock --update-input ema or just nix flake update (the latter updates all Nix inputs)
    • To add/remove Haskell dependencies, see the .cabal file. If a dependency is unavailable in nixpkgs, you can override it (to point to say a Git repo) in the source-overrides (or overrides if you need more power) attribute of flake.nix. You can imitate the ema package itself is overridden.
  • To generate the site, run:
    mkdir ../output 
    nix run . -- --base-url=/ gen ../output

Non-Nix workflow

To use this repository without Nix, such as with plain Cabal or Stack, you need to have the following installed manually:

Once all the above are installed, run foreman start to start the Ema live server.

About

Theoretically optimal distribution of aid for flood-stricken Pakistan (2022)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published