Skip to content

Commit

Permalink
Add flake file
Browse files Browse the repository at this point in the history
  • Loading branch information
woutdp committed Jan 17, 2024
1 parent e51cc18 commit 970d836
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 0 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ node_modules/

# Build files
priv/static/

# Direnv
.direnv
.nix-hex
.nix-mix
.erlang-history
61 changes: 61 additions & 0 deletions flake.lock

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

51 changes: 51 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
description =
"A flake for building development environment of Phoenix project.";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in with pkgs; {
devShells.default = mkShell {
buildInputs =
[ erlangR26 beam.packages.erlangR26.elixir_1_16 nodejs-18_x ]
++ lib.optionals stdenv.isLinux [
# For ExUnit Notifier on Linux.
libnotify

# For file_system on Linux.
inotify-tools
] ++ lib.optionals stdenv.isDarwin ([
# For ExUnit Notifier on macOS.
terminal-notifier

# For file_system on macOS.
darwin.apple_sdk.frameworks.CoreFoundation
darwin.apple_sdk.frameworks.CoreServices
]);

shellHook = ''
# allows mix to work on the local directory
mkdir -p .nix-mix
mkdir -p .nix-hex
export MIX_HOME=$PWD/.nix-mix
export HEX_HOME=$PWD/.nix-hex
export ERL_LIBS=$HEX_HOME/lib/erlang/lib
# concats PATH
export PATH=$MIX_HOME/bin:$PATH
export PATH=$MIX_HOME/escripts:$PATH
export PATH=$HEX_HOME/bin:$PATH
# enables history for IEx
export ERL_AFLAGS="-kernel shell_history enabled -kernel shell_history_path '\"$PWD/.erlang-history\"'"
'';
};
});
}

0 comments on commit 970d836

Please sign in to comment.