dev-templates/elixir/flake.nix

38 lines
1.1 KiB
Nix
Raw Normal View History

2022-07-28 15:47:10 -07:00
{
description = "A Nix-flake-based Elixir development environment";
2022-08-20 03:06:53 -07:00
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs";
};
2022-07-28 15:47:10 -07:00
2022-08-20 03:06:53 -07:00
outputs = { self, flake-utils, nixpkgs }:
flake-utils.lib.eachDefaultSystem (system:
2022-07-28 15:47:10 -07:00
let
pkgs = import nixpkgs { inherit system; };
2022-07-28 15:58:11 -07:00
inherit (pkgs)
2022-08-10 06:25:16 -07:00
darwin gigalixir inotify-tools libnotify mkShell terminal-notifier;
2022-07-28 15:58:11 -07:00
inherit (pkgs.beam.packages.erlangR25) elixir elixir_ls;
2022-08-02 03:57:37 -07:00
inherit (pkgs.darwin.apple_sdk.frameworks) CoreFoundation CoreServices;
2022-07-28 15:47:10 -07:00
inherit (pkgs.lib) optionals;
inherit (pkgs.stdenv) isDarwin isLinux;
2022-08-02 03:57:37 -07:00
linuxDeps = optionals isLinux [ gigalixir inotify-tools libnotify ];
2022-07-28 15:58:11 -07:00
darwinDeps = optionals isDarwin [ terminal-notifier ]
2022-08-02 03:57:37 -07:00
++ [ CoreFoundation CoreServices ];
2022-08-20 04:47:43 -07:00
in
{
2022-07-28 15:47:10 -07:00
devShells = {
default = mkShell {
2022-08-10 06:25:16 -07:00
buildInputs = [ elixir elixir_ls ] ++ linuxDeps ++ darwinDeps;
2022-07-28 15:47:10 -07:00
shellHook = ''
${elixir}/bin/mix --version
${elixir}/bin/iex --version
'';
};
};
});
}