This commit is contained in:
parent
5481cdb362
commit
d5d4a1d96c
6 changed files with 103 additions and 73 deletions
27
templates/elixir/flake.lock
Normal file
27
templates/elixir/flake.lock
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1734435836,
|
||||
"narHash": "sha256-kMBQ5PRiFLagltK0sH+08aiNt3zGERC2297iB6vrvlU=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "4989a246d7a390a859852baddb1013f825435cee",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -3,79 +3,11 @@
|
|||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (self) outputs;
|
||||
|
||||
supportedSystems = [
|
||||
"aarch64-linux"
|
||||
"x86_64-linux"
|
||||
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
|
||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||
|
||||
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);
|
||||
outputs = inputs: let
|
||||
inherit (import nix/boilerplate.nix inputs) call;
|
||||
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;
|
||||
in {
|
||||
default = pkgs.mkShell {
|
||||
shellHook = "export LOCALE_ARCHIVE=/usr/lib/locale/locale-archive";
|
||||
buildInputs = with pkgs; [
|
||||
elixir
|
||||
elixir-ls
|
||||
|
||||
inotify-tools
|
||||
];
|
||||
};
|
||||
});
|
||||
overlays = import nix/overlays.nix;
|
||||
packages = call (import nix/packages.nix);
|
||||
devShells = call (import nix/shells.nix);
|
||||
};
|
||||
}
|
||||
|
|
16
templates/elixir/nix/boilerplate.nix
Normal file
16
templates/elixir/nix/boilerplate.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
inputs @ {
|
||||
nixpkgs,
|
||||
self,
|
||||
...
|
||||
}: let
|
||||
forSelfOverlay =
|
||||
if builtins.hasAttr "forSelf" self.overlays
|
||||
then self.overlays.forSelf
|
||||
else (_: p: p);
|
||||
in rec {
|
||||
systems = ["aarch64-linux" "x86_64-linux" "x86_64-darwin" "aarch64-darwin"];
|
||||
forSystems = nixpkgs.lib.genAttrs systems;
|
||||
pkgsFor = system: ((import nixpkgs {inherit system;}).extend forSelfOverlay);
|
||||
genPkgs = func: (forSystems (system: func (pkgsFor system)));
|
||||
call = imported: genPkgs (pkgs: imported (inputs // {inherit pkgs;}));
|
||||
}
|
16
templates/elixir/nix/overlays.nix
Normal file
16
templates/elixir/nix/overlays.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
forrSelf = final: prev: {
|
||||
erlangPackages = prev.beam.packagesWith prev.erlang_28;
|
||||
erlang = final.erlangPackages.erlang;
|
||||
elixir = final.erlangPackages.elixir_1_17;
|
||||
|
||||
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;};
|
||||
};
|
||||
}
|
24
templates/elixir/nix/packages.nix
Normal file
24
templates/elixir/nix/packages.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
pkgs,
|
||||
self,
|
||||
...
|
||||
}: {
|
||||
my-package = let
|
||||
version = "1.0.0";
|
||||
src = ./.;
|
||||
pname = "my-package";
|
||||
in
|
||||
pkgs.beamPackages.mixRelease {
|
||||
inherit pname version src;
|
||||
mixFodDeps = pkgs.beamPackages.fetchMixDeps {
|
||||
inherit version src;
|
||||
pname = "mix-deps-${pname}";
|
||||
hash = pkgs.lib.fakeSha256;
|
||||
};
|
||||
# buildInputs = with pkgs; [];
|
||||
# HOME = "$(pwd)";
|
||||
# MIX_XDG = "$HOME";
|
||||
};
|
||||
|
||||
default = self.packages.${pkgs.system}.my-package;
|
||||
}
|
15
templates/elixir/nix/shells.nix
Normal file
15
templates/elixir/nix/shells.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
pkgs,
|
||||
# self,
|
||||
...
|
||||
}: {
|
||||
elixir-dev = pkgs.mkShell {
|
||||
shellHook = "export LOCALE_ARCHIVE=/usr/lib/locale/locale-archive";
|
||||
# inputsFrom = [self.packages.${pkgs.system}.my-package];
|
||||
buildInputs = with pkgs; [
|
||||
elixir
|
||||
elixir-ls
|
||||
inotify-tools
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue