dev-templates/elixir/flake.nix

40 lines
1.1 KiB
Nix
Raw Normal View History

2022-07-29 00:47:10 +02:00
{
description = "A Nix-flake-based 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; };
2022-07-29 00:58:11 +02:00
inherit (pkgs)
darwin inotify-tools mkShell nodejs-18_x terminal-notifier;
inherit (pkgs.beam.packages.erlangR25) elixir elixir_ls;
2022-07-29 00:47:10 +02:00
inherit (pkgs.lib) optionals;
inherit (pkgs.stdenv) isDarwin isLinux;
2022-07-29 00:58:11 +02:00
linuxDeps = optionals isLinux [ inotify-tools ];
darwinDeps = optionals isDarwin [ terminal-notifier ]
++ (with darwin.apple_sdk.frameworks; [
CoreFoundation
CoreServices
]);
2022-07-29 00:47:10 +02:00
in {
devShells = {
default = mkShell {
2022-07-29 00:58:11 +02:00
buildInputs = [ elixir elixir_ls nodejs-18_x ] ++ linuxDeps
++ darwinDeps;
2022-07-29 00:47:10 +02:00
shellHook = ''
${elixir}/bin/mix --version
${elixir}/bin/iex --version
'';
};
};
});
}