diff --git a/README.md b/README.md index b8c1dbb..72b22b3 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ See [memoet.gitbook.io](https://memoet.gitbook.io/docs). ## Developer guide +### Standard way of setting up your development environment + 1. Install `asdf` Follow instructions [here](https://asdf-vm.com/). @@ -28,6 +30,7 @@ asdf install 4. Install project dependencies ```sh +mix setup mix deps.get (cd assets && npm i) ``` @@ -39,6 +42,14 @@ mix ecto.setup mix phx.server ``` +### Nix-shell way of setting up your development environment + +This way of setup works only wwhen you have Nix configured for your OS, or are using NixOS + +```sh +NIX_ENFORCE_PURITY=0 nix-shell +``` + Now you can visit [`localhost:4000`](http://localhost:4000) from your browser. ## Deployment diff --git a/assets/package-lock.json b/assets/package-lock.json index 96bfa25..70b0fbe 100644 --- a/assets/package-lock.json +++ b/assets/package-lock.json @@ -4,7 +4,6 @@ "requires": true, "packages": { "": { - "name": "assets", "license": "AGPL-3.0-only", "dependencies": { "@fontsource/nunito-sans": "^4.5.1", diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..ea9c51f --- /dev/null +++ b/shell.nix @@ -0,0 +1,34 @@ +{ pkgs ? import { + config = { + # oops, 16 is now EOL + permittedInsecurePackages = [ "nodejs-16.20.2" ]; + }; +} }: + +let + rust = pkgs.rustc; + cargo = pkgs.cargo; + erlang = pkgs.erlang_24; + elixir = pkgs.elixir_1_13; + nodejs = pkgs.nodejs_16; +in +pkgs.mkShell { + buildInputs = [ elixir nodejs rust cargo pkgs.erlang pkgs.postgresql ]; + + shellHook = '' + # spin up the Postgresql container + docker run --name postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 -d postgres:13 + + # create the .env file + echo "export DATABASE_URL=postgres://postgres:postgres@postgres/postgres" > .env + echo "export SECRET_KEY_BASE=$(openssl rand -hex 48)" >> .env + echo "export URL_HOST=localhost" >> .env + echo "export URL_SCHEMA=http" >> .env + echo "export URL_PORT=4000" >> .env + + mix setup + mix deps.get + mix ecto.setup + mix phx.server + ''; +}