Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(phoenix): add example for elixir phoenix #803

Merged
merged 5 commits into from
Sep 4, 2023
Merged
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 examples/phoenix/.test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
set -ex
mix local.hex --force
mix local.rebar --force
echo Y | mix archive.install hex phx_new
echo Y | mix phx.new hello
sed -i.bak -e "s/username: \"postgres\",/socket_dir: System.get_env(\"PGDATA\"),/" \
./hello/config/dev.exs && rm ./hello/config/dev.exs.bak
devenv up&
timeout 20 bash -c 'until echo > /dev/tcp/localhost/4000; do sleep 0.5; done'
curl -s http://localhost:4000/ | grep "Phoenix Framework"
12 changes: 12 additions & 0 deletions examples/phoenix/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Based on [the official tutorial](https://hexdocs.pm/phoenix/installation.html).

```shell-session
$ devenv shell
$ mix local.hex --force
$ mix local.rebar --force
$ mix archive.install hex phx_new
$ mix phx.new hello
$ sed -i.bak -e "s/username: \"postgres\",/socket_dir: System.get_env(\"PGDATA\"),/" \
./hello/config/dev.exs && rm ./hello/config/dev.exs.bak
$ devenv up
```
11 changes: 11 additions & 0 deletions examples/phoenix/devenv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{ pkgs, lib, ... }:

{
packages = lib.optionals pkgs.stdenv.isLinux [ pkgs.inotify-tools ];

languages.elixir.enable = true;

services.postgres.enable = true;

processes.phoenix.exec = "cd hello && mix ecto.create && mix phx.server";
}
3 changes: 3 additions & 0 deletions examples/phoenix/devenv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
inputs:
nixpkgs:
url: github:NixOS/nixpkgs/nixpkgs-unstable
Loading