nix/elixir/flake.nix
2026-04-03 18:31:37 +02:00

56 lines
1.3 KiB
Nix

{
description = "minimal flake for elixir dev";
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
outputs = {self, ...} @ inputs: let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
forEachSupportedSystem = f:
inputs.nixpkgs.lib.genAttrs supportedSystems (
system:
f {
inherit system;
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [inputs.self.overlays.default];
};
}
);
in {
overlays.default = final: prev: rec {
erlang = final.beam.interpreters.erlang_27;
pkgs-beam = final.beam.packagesWith erlang;
elixir = pkgs-beam.elixir_1_17;
};
devShells = forEachSupportedSystem (
{
pkgs,
system,
}: {
default = pkgs.mkShellNoCC {
packages = with pkgs;
[
elixir
self.formatter.${system}
]
++
# Linux only
pkgs.lib.optionals pkgs.stdenv.isLinux (
with pkgs; [
gigalixir
inotify-tools
libnotify
]
);
};
}
);
formatter = forEachSupportedSystem ({pkgs, ...}: pkgs.nixfmt);
};
}