Skip to content

Instantly share code, notes, and snippets.

@suvash
Created October 21, 2023 12:44
Show Gist options
  • Save suvash/ec74d355ea85e5604f0a6a1642576c01 to your computer and use it in GitHub Desktop.
Save suvash/ec74d355ea85e5604f0a6a1642576c01 to your computer and use it in GitHub Desktop.
Elixir Nix Flake Devshell (Flake for running Elixir 1.15 / Erlang R25)
{
description = "Phoenix(Elixir) development environment";
inputs = {
nixpkgs = { url = "github:NixOS/nixpkgs/nixos-23.05"; };
flake-utils = { url = "github:numtide/flake-utils"; };
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
inherit (nixpkgs.lib) optional;
pkgs = import nixpkgs { inherit system; };
erlangVersion = "erlangR25";
elixirVersion = "elixir_1_15";
erlang = pkgs.beam.interpreters.${erlangVersion};
elixir = pkgs.beam.packages.${erlangVersion}.${elixirVersion};
elixir-ls = pkgs.beam.packages.${erlangVersion}.elixir-ls;
locales = pkgs.glibcLocales;
fileWatchers = with pkgs;
(lib.optionals stdenv.isLinux [ inotify-tools ]
++ lib.optionals stdenv.isDarwin
(with darwin.apple_sdk.frameworks; [
CoreFoundation
CoreServices
]));
notifiers = with pkgs;
(lib.optionals stdenv.isLinux [ libnotify ]
++ lib.optionals stdenv.isDarwin [ terminal-notifier ]);
in {
devShell = pkgs.mkShell {
buildInputs =
[ erlang elixir elixir-ls locales fileWatchers notifiers ];
};
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment