Skip to content

Commit

Permalink
upgrade elixir
Browse files Browse the repository at this point in the history
  • Loading branch information
zoedsoupe committed Apr 21, 2024
1 parent 82d2cfa commit 2812f93
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 67 deletions.
27 changes: 0 additions & 27 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,4 @@ export LANG=en_US.UTF-8

use flake

# Setup postgresql
if test -d "/Applications/Postgres.app"; then
export DATABASE_USER="$(whoami)"
export DATABASE_PASSWORD=""
else
# postges related
export DATABASE_USER="supabase_potion"
export DATABASE_PASSWORD="supabase_potion"
export PG_DATABASE="supabase_potion_dev"
# keep all your db data in a folder inside the project
export PGHOST="$PWD/.postgres"
export PGDATA="$PGHOST/data"
export PGLOG="$PGHOST/server.log"

if [[ ! -d "$PGDATA" ]]; then
# initital set up of database server
initdb --auth=trust --no-locale --encoding=UTF8 -U=$DATABASE_USER >/dev/null

# point to correct unix sockets
echo "unix_socket_directories = '$PGHOST'" >> "$PGDATA/postgresql.conf"
# creates loacl database user
echo "CREATE USER $DATABASE_USER SUPERUSER;" | postgres --single -E postgres
# creates local databse
echo "CREATE DATABASE $PG_DATABASE;" | postgres --single -E postgres
fi
fi

source .env
67 changes: 61 additions & 6 deletions flake.lock

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

72 changes: 38 additions & 34 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,39 +1,43 @@
{
description = "A complete Supabase SDK for Elixir alchemists";
description = "Supabase GoTrue SDK for Elixir";

outputs = {nixpkgs, ...}: let
for-all-systems = function:
nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-darwin"
] (system:
function rec {
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs.beam.interpreters) erlang_26;
inherit (pkgs.beam) packagesWith;
beam-pkgs = packagesWith erlang_26;
deps = import ./nix/deps.nix {
inherit (pkgs) lib;
beamPackages = beam-pkgs;
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
flake-parts.url = "github:hercules-ci/flake-parts";
systems.url = "github:nix-systems/default";
};

outputs = {
flake-parts,
systems,
...
} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = import systems;
perSystem = {
pkgs,
system,
...
}: let
inherit (pkgs.beam.interpreters) erlangR26;
inherit (pkgs.beam) packagesWith;
beam = packagesWith erlangR26;
in {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
};
devShells.default = with pkgs;
mkShell {
name = "gotrue-ex";
packages = with pkgs;
[beam.elixir_1_16]
++ lib.optional stdenv.isLinux [inotify-tools]
++ lib.optional stdenv.isDarwin [
darwin.apple_sdk.frameworks.CoreServices
darwin.apple_sdk.frameworks.CoreFoundation
];
};
});
in {
devShells = for-all-systems ({
pkgs,
beam-pkgs,
...
}: rec {
default = supabase-potion;
supabase-potion = pkgs.mkShell {
name = "supabase-potion";
shellHook = "mkdir -p $PWD/.nix-mix";
packages = with pkgs;
[beam-pkgs.elixir_1_15 earthly]
++ lib.optional stdenv.isDarwin [
darwin.apple_sdk.frameworks.CoreServices
darwin.apple_sdk.frameworks.CoreFoundation
];
};
});
};
};
}

0 comments on commit 2812f93

Please sign in to comment.