Add elixir flake template, update templates to use nixos-unstable nixpkgs

This commit is contained in:
Daniel Flanagan 2024-02-20 20:13:13 -06:00
parent b77283f7ba
commit aa520ec9b1
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
5 changed files with 85 additions and 2 deletions

View file

@ -1,5 +1,5 @@
{ {
inputs.nixpkgs.url = "github:NixOS/nixpkgs?rev=bd645e8668ec6612439a9ee7e71f7eac4099d4f6"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { outputs = {
self, self,

1
templates/elixir/.envrc Normal file
View file

@ -0,0 +1 @@
use flake

22
templates/elixir/.gitignore vendored Normal file
View file

@ -0,0 +1,22 @@
# secret files
*.secret.*
# build output
/_build
# elixir dependencies
/deps
# crash dumps
erl_crash.dump
# sqlite databases
*.db
*.db-shm
*.db-wal
# nix build output
/result
# direnv cache
/.direnv

View file

@ -0,0 +1,60 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
};
outputs = {
self,
nixpkgs,
...
}: let
inherit (self) outputs;
systems = [
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
"x86_64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
nixpkgsFor = system: import nixpkgs {inherit system;};
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 {
# 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";
# };
# default = outputs.packages.${system}.this-package;
});
devShells = forAllSystems (system: let
pkgs = nixpkgsFor system;
erlang = pkgs.beam.packages.erlang_26;
elixir = erlang.elixir_1_15;
in {
default = pkgs.mkShell {
shellHook = "export LOCALE_ARCHIVE=/usr/lib/locale/locale-archive";
buildInputs = [erlang elixir pkgs.elixir-ls];
};
});
};
}

View file

@ -1,5 +1,5 @@
{ {
inputs.nixpkgs.url = "github:NixOS/nixpkgs?rev=bd645e8668ec6612439a9ee7e71f7eac4099d4f6"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { outputs = {
self, self,
nixpkgs, nixpkgs,