From 6db7f7667035156e05fafc64f6e35966d06a9d0b Mon Sep 17 00:00:00 2001 From: Frank Hunleth Date: Thu, 2 Jul 2026 13:28:39 -0400 Subject: [PATCH 1/3] impl's created an inadvertent dependency The @impl's by the placeholder functions inadvertently created warnings even though the code to call the callbacks was removed in Nerves 2. This just gets rid of all external module references to be safe. --- template/lib/package_name.ex.eex | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/template/lib/package_name.ex.eex b/template/lib/package_name.ex.eex index c634ecc..ec8696e 100644 --- a/template/lib/package_name.ex.eex +++ b/template/lib/package_name.ex.eex @@ -1,29 +1,28 @@ defmodule <%= @module_name %> do @moduledoc false - use Nerves.Package.Platform + # This module's only purpose is get rid of error messages when used with Nerves 1.x + + # The functions needed to be implemented when using Nerves.Package.Platform. Implement + # anyway, but don't require Nerves.Package.Platform to be around. + # use Nerves.Package.Platform - @impl Nerves.Package.Platform def bootstrap(_pkg) do :ok end - @impl Nerves.Package.Platform def build_path_link(_pkg) do # Unused since never built via Nerves tooling "Run build.sh directly" end - @impl Nerves.Artifact.BuildRunner def build(_pkg, _toolchain, _opts) do {:error, "Run build.sh directly"} end - @impl Nerves.Artifact.BuildRunner def archive(_pkg, _toolchain, _opts) do {:error, "Run build.sh directly"} end - @impl Nerves.Artifact.BuildRunner def clean(_pkg) do {:error, "Run build.sh directly"} end From b31145a08dec45b8e478a133442b8b1d125caa34 Mon Sep 17 00:00:00 2001 From: Frank Hunleth Date: Wed, 12 Aug 2026 17:23:48 -0400 Subject: [PATCH 2/3] Remove unneeded Nerves package compiler This isn't needed and simplifies Nerves 2's need to support older APIs. --- template/mix.exs.eex | 8 -------- 1 file changed, 8 deletions(-) diff --git a/template/mix.exs.eex b/template/mix.exs.eex index 2b43bf4..a155147 100644 --- a/template/mix.exs.eex +++ b/template/mix.exs.eex @@ -16,20 +16,12 @@ defmodule <%= @module_name %>.MixProject do description: @description, package: package(), source_url: @source_url, - compilers: compilers(Mix.env()), nerves_package: nerves_package(), deps: deps(), docs: docs() ] end - # Removing Nerves.Toolchain.CTNG had the side effect of introducing a - # circular dependency between Nerves bootstram and compiling the platform. - # Since we no longer support compiling the toolchain via the Nerves tooling, - # use the environment to see whether this is the root project or not. - defp compilers(:prod), do: [:nerves_package | Mix.compilers()] - defp compilers(_), do: Mix.compilers() - def application do [] end From ff3caa9e9e94c1d1d8df64543a90d96f9cf661df Mon Sep 17 00:00:00 2001 From: Frank Hunleth Date: Wed, 12 Aug 2026 17:32:03 -0400 Subject: [PATCH 3/3] Allow toolchains to be used with Nerves 2 --- template/mix.exs.eex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/mix.exs.eex b/template/mix.exs.eex index a155147..9f07d9c 100644 --- a/template/mix.exs.eex +++ b/template/mix.exs.eex @@ -45,7 +45,7 @@ defmodule <%= @module_name %>.MixProject do defp deps do [ {:ex_doc, "~> 0.22", only: :docs, runtime: false}, - {:nerves, "~> 1.13", runtime: false} + {:nerves, "~> 1.13 or ~> 2.0", runtime: false} ] end