Skip to content

Commit

Permalink
chore: add nix flake
Browse files Browse the repository at this point in the history
  • Loading branch information
c4710n committed Dec 7, 2023
1 parent c00ee48 commit 73d1a24
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 0 deletions.
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.

52 changes: 52 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
description = "Elixir development environment";

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

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in
{
devShells.default = with pkgs; mkShell {
packages = [
beam.packages.erlang_26.elixir_1_15
] ++
# Linux only
lib.optionals stdenv.isLinux [
# for ExUnit notifier
libnotify

# for package - file_system
inotify-tools
] ++
# Darwin only
lib.optionals stdenv.isDarwin [
# for ExUnit notifier
terminal-notifier

# for package - file_system
darwin.apple_sdk.frameworks.CoreFoundation
darwin.apple_sdk.frameworks.CoreServices
];

shellHook = ''
# limit mix to current project
mkdir -p .nix-mix
export MIX_HOME=$PWD/.nix-mix
# rewire executables
export PATH=$MIX_HOME/bin:$PATH
export PATH=$MIX_HOME/escripts:$PATH
# limit history to current project
export ERL_AFLAGS="-kernel shell_history enabled -kernel shell_history_path '\"$PWD/.erlang-history\"'"
'';
};
}
);
}

0 comments on commit 73d1a24

Please sign in to comment.