nix/templates/elixir/flake.nix

82 lines
1.8 KiB
Nix
Raw Permalink Normal View History

{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
};
outputs = {
self,
nixpkgs,
...
}: let
inherit (self) outputs;
2024-03-19 10:25:29 -05:00
supportedSystems = [
"aarch64-linux"
"x86_64-linux"
2024-03-19 10:25:29 -05:00
"x86_64-darwin"
"aarch64-darwin"
];
2024-03-19 10:25:29 -05:00
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
2024-04-12 10:20:53 -05:00
overlay = final: prev: {
erlangPackages = prev.beam.packagesWith prev.erlang_26;
erlang = final.erlangPackages.erlang;
elixir = final.erlangPackages.elixir_1_16;
mixRelease = final.erlangPackages.mixRelease.override {
elixir = final.elixir;
};
fetchMixDeps = final.erlangPackages.fetchMixDeps.override {
elixir = final.elixir;
};
elixir-ls = prev.elixir-ls.override {elixir = final.elixir;};
};
nixpkgsFor = system: ((import nixpkgs {inherit system;}).extend overlay);
in {
packages = forAllSystems (system: let
pkgs = nixpkgsFor system;
inherit (pkgs) beamPackages;
inherit (beamPackages) mixRelease fetchMixDeps;
version = "0.1.0";
src = ./.;
pname = "api.lyte.dev";
in {
2024-09-12 11:58:24 -05:00
/*
this-package = mixRelease {
inherit pname version src;
mixFodDeps = fetchMixDeps {
inherit version src;
pname = "mix-deps-${pname}";
hash = pkgs.lib.fakeSha256;
};
buildInputs = with pkgs; [sqlite];
HOME = "$(pwd)";
MIX_XDG = "$HOME";
};
2024-09-12 11:58:24 -05:00
default = outputs.packages.${system}.this-package;
*/
});
devShells = forAllSystems (system: let
pkgs = nixpkgsFor system;
in {
default = pkgs.mkShell {
shellHook = "export LOCALE_ARCHIVE=/usr/lib/locale/locale-archive";
2024-02-20 21:18:12 -06:00
buildInputs = with pkgs; [
elixir
2024-04-12 10:20:53 -05:00
elixir-ls
inotify-tools
2024-02-20 21:18:12 -06:00
];
};
});
};
}