Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/).
Expand All @@ -28,6 +30,7 @@ asdf install
4. Install project dependencies

```sh
mix setup
mix deps.get
(cd assets && npm i)
```
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion assets/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{ pkgs ? import <nixpkgs> {
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
'';
}