elixir: simplifiy generic builder and overriding

This commit is contained in:
Adam C. Stephens
2025-10-20 21:08:37 -04:00
parent 459986346a
commit b044ad6e5e
8 changed files with 40 additions and 99 deletions
+5 -5
View File
@@ -51,27 +51,27 @@ let
# BEAM-based languages.
elixir = elixir_1_18;
elixir_1_19 = lib'.callElixir ../interpreters/elixir/1.19.nix {
elixir_1_19 = callPackage ../interpreters/elixir/1.19.nix {
inherit erlang;
debugInfo = true;
};
elixir_1_18 = lib'.callElixir ../interpreters/elixir/1.18.nix {
elixir_1_18 = callPackage ../interpreters/elixir/1.18.nix {
inherit erlang;
debugInfo = true;
};
elixir_1_17 = lib'.callElixir ../interpreters/elixir/1.17.nix {
elixir_1_17 = callPackage ../interpreters/elixir/1.17.nix {
inherit erlang;
debugInfo = true;
};
elixir_1_16 = lib'.callElixir ../interpreters/elixir/1.16.nix {
elixir_1_16 = callPackage ../interpreters/elixir/1.16.nix {
inherit erlang;
debugInfo = true;
};
elixir_1_15 = lib'.callElixir ../interpreters/elixir/1.15.nix {
elixir_1_15 = callPackage ../interpreters/elixir/1.15.nix {
inherit erlang;
debugInfo = true;
};
-44
View File
@@ -38,48 +38,4 @@ rec {
versionArgs: import ../../development/interpreters/erlang/generic-builder.nix (versionArgs // args);
in
pkgs.callPackage (import drv genericBuilder) { };
/*
Uses generic-builder to evaluate provided drv containing Elixir version
specific data.
drv: file containing version-specific args;
genericBuilder: generic builder for all Erlang versions;
args: arguments merged into version-specific args, used mostly to customize
high level options;
Arguments passed to the generic-builder are overridable.
*/
callElixir =
drv: args:
let
builder = callPackage ../interpreters/elixir/generic-builder.nix args;
in
callPackage drv {
mkDerivation = pkgs.makeOverridable builder;
};
/*
Uses generic-builder to evaluate provided drv containing Elixir version
specific data.
drv: package containing version-specific args;
builder: generic builder for all Erlang versions;
args: arguments merged into version-specific args, used mostly to customize
dependencies;
Arguments passed to the generic-builder are overridable.
Please note that "mkDerivation" defined here is the one called from 1.2.nix
and similar files.
*/
callLFE =
drv: args:
let
builder = callPackage ../interpreters/lfe/generic-builder.nix args;
in
callPackage drv {
mkDerivation = pkgs.makeOverridable builder;
};
}
@@ -1,9 +1,7 @@
{ mkDerivation }:
mkDerivation {
import ./generic-builder.nix {
version = "1.15.7";
sha256 = "sha256-6GfZycylh+sHIuiQk/GQr1pRQRY1uBycSQdsVJ0J13k=";
hash = "sha256-6GfZycylh+sHIuiQk/GQr1pRQRY1uBycSQdsVJ0J13k=";
# https://hexdocs.pm/elixir/1.15.0/compatibility-and-deprecations.html#compatibility-between-elixir-and-erlang-otp
minimumOTPVersion = "24";
maximumOTPVersion = "26";
escriptPath = "lib/elixir/scripts/generate_app.escript";
}
@@ -1,9 +1,7 @@
{ mkDerivation }:
mkDerivation {
import ./generic-builder.nix {
version = "1.16.3";
sha256 = "sha256-WUBqoz3aQvBlSG3pTxGBpWySY7I0NUcDajQBgq5xYTU=";
hash = "sha256-WUBqoz3aQvBlSG3pTxGBpWySY7I0NUcDajQBgq5xYTU=";
# https://hexdocs.pm/elixir/1.16.0/compatibility-and-deprecations.html#compatibility-between-elixir-and-erlang-otp
minimumOTPVersion = "24";
maximumOTPVersion = "26";
escriptPath = "lib/elixir/scripts/generate_app.escript";
}
@@ -1,9 +1,7 @@
{ mkDerivation }:
mkDerivation {
import ./generic-builder.nix {
version = "1.17.3";
sha256 = "sha256-7Qo6y0KAQ9lwD4oH+7wQ4W5i6INHIBDN9IQAAsYzNJw=";
hash = "sha256-7Qo6y0KAQ9lwD4oH+7wQ4W5i6INHIBDN9IQAAsYzNJw=";
# https://hexdocs.pm/elixir/1.17.3/compatibility-and-deprecations.html#compatibility-between-elixir-and-erlang-otp
minimumOTPVersion = "25";
maximumOTPVersion = "27";
escriptPath = "lib/elixir/scripts/generate_app.escript";
}
@@ -1,8 +1,6 @@
{ mkDerivation }:
mkDerivation {
import ./generic-builder.nix {
version = "1.18.4";
sha256 = "sha256-PwogI+HfRXy5M7Xn/KyDjm5vUquTBoGxliSV0A2AwSA=";
hash = "sha256-PwogI+HfRXy5M7Xn/KyDjm5vUquTBoGxliSV0A2AwSA=";
# https://hexdocs.pm/elixir/1.18.0/compatibility-and-deprecations.html#between-elixir-and-erlang-otp
minimumOTPVersion = "25";
escriptPath = "lib/elixir/scripts/generate_app.escript";
}
@@ -1,9 +1,7 @@
{ mkDerivation }:
mkDerivation {
import ./generic-builder.nix {
version = "1.19.1";
sha256 = "sha256-0rJx1BoJGDS0FsXyngBfQL3LhhNZvwh+TLQZjqOPFQw=";
hash = "sha256-0rJx1BoJGDS0FsXyngBfQL3LhhNZvwh+TLQZjqOPFQw=";
# https://hexdocs.pm/elixir/1.19.0-rc.1/compatibility-and-deprecations.html#between-elixir-and-erlang-otp
minimumOTPVersion = "26";
maximumOTPVersion = "28";
escriptPath = "lib/elixir/scripts/generate_app.escript";
}
@@ -1,32 +1,22 @@
{
config,
lib,
stdenv,
fetchFromGitHub,
erlang,
makeWrapper,
nix-update-script,
coreutils,
curl,
bash,
debugInfo ? false,
}@inputs:
{
baseName ? "elixir",
version,
erlang ? inputs.erlang,
hash,
minimumOTPVersion,
maximumOTPVersion ? null,
sha256 ? null,
rev ? "v${version}",
src ? fetchFromGitHub {
inherit rev sha256;
owner = "elixir-lang";
repo = "elixir";
},
escriptPath ? "lib/elixir/generate_app.escript",
}@args:
}:
{
bash,
config,
coreutils,
curl,
debugInfo ? false,
erlang,
fetchFromGitHub,
lib,
makeWrapper,
nix-update-script,
stdenv,
}:
let
inherit (lib)
@@ -79,9 +69,16 @@ if !config.allowAliases && !bothAssert then
else
assert assertMsg bothAssert compatibilityMsg;
stdenv.mkDerivation {
pname = "${baseName}";
pname = "elixir";
inherit src version debugInfo;
src = fetchFromGitHub {
owner = "elixir-lang";
repo = "elixir";
rev = "v${version}";
inherit hash;
};
inherit version debugInfo;
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ erlang ];
@@ -95,7 +92,7 @@ else
};
preBuild = ''
patchShebangs ${escriptPath} || true
patchShebangs lib/elixir/scripts/generate_app.escript || true
'';
# copy stdlib source files for LSP access
@@ -136,8 +133,6 @@ else
];
};
pos = builtins.unsafeGetAttrPos "sha256" args;
meta = {
homepage = "https://elixir-lang.org/";
description = "Functional, meta-programming aware language built on top of the Erlang VM";