fix(overlay): avoid recursion with final.lib, use prev.lib.optionalAttrs

Replace recursive `final.lib.optionalAttrs` with `prev.lib.optionalAttrs`
using the `?` operator to check for meshtastic existence safely.
This allows the overlay to work with both stable (25.11) and unstable.
This commit is contained in:
2026-06-07 06:45:16 -04:00
parent 346b41995f
commit 8e395729ff

View File

@@ -1,88 +1,86 @@
final: prev: let final: prev: let
inherit (final.lib) optionalAttrs;
python3 = final.python3; python3 = final.python3;
pyPkgs = python3.pkgs; pyPkgs = python3.pkgs;
in { in
reticulumStack = python3.pkgs.buildPythonApplication rec { {
pname = "reticulum"; reticulumStack = python3.pkgs.buildPythonApplication rec {
version = "1.2.9"; pname = "reticulum";
format = "setuptools"; version = "1.2.9";
src = pyPkgs.fetchPypi { format = "setuptools";
pname = "rns"; src = pyPkgs.fetchPypi {
inherit version; pname = "rns";
sha256 = "554814231c237b9caacf8df669312e57dd7d3f84b6d4810125087d1a79a75d75"; inherit version;
sha256 = "554814231c237b9caacf8df669312e57dd7d3f84b6d4810125087d1a79a75d75";
};
propagatedBuildInputs = with pyPkgs; [ cryptography pyserial ];
doCheck = false;
pythonImportsCheck = [ "RNS" ];
meta = with final.lib; {
description = "Self-configuring, encrypted and resilient mesh networking stack";
homepage = "https://reticulum.network/";
license = licenses.mit;
platforms = platforms.linux;
};
}; };
propagatedBuildInputs = with pyPkgs; [ cryptography pyserial ];
doCheck = false;
pythonImportsCheck = [ "RNS" ];
meta = with final.lib; {
description = "Self-configuring, encrypted and resilient mesh networking stack";
homepage = "https://reticulum.network/";
license = licenses.mit;
platforms = platforms.linux;
};
};
lxmf = python3.pkgs.buildPythonApplication rec { lxmf = python3.pkgs.buildPythonApplication rec {
pname = "lxmf"; pname = "lxmf";
version = "0.9.8"; version = "0.9.8";
format = "setuptools"; format = "setuptools";
src = pyPkgs.fetchPypi { src = pyPkgs.fetchPypi {
inherit pname version; inherit pname version;
sha256 = "30f39f3a975a049c12ee2cfceb3261d24cb5adec881c6821f7354464b3f3650c"; sha256 = "30f39f3a975a049c12ee2cfceb3261d24cb5adec881c6821f7354464b3f3650c";
};
propagatedBuildInputs = [ final.reticulumStack ];
doCheck = false;
pythonImportsCheck = [ "LXMF" ];
meta = with final.lib; {
description = "Lightweight Extensible Message Format for Reticulum";
homepage = "https://github.com/markqvist/lxmf";
license = licenses.mit;
platforms = platforms.linux;
};
}; };
propagatedBuildInputs = [ final.reticulumStack ];
doCheck = false;
pythonImportsCheck = [ "LXMF" ];
meta = with final.lib; {
description = "Lightweight Extensible Message Format for Reticulum";
homepage = "https://github.com/markqvist/lxmf";
license = licenses.mit;
platforms = platforms.linux;
};
};
nomadnet = python3.pkgs.buildPythonApplication rec { nomadnet = python3.pkgs.buildPythonApplication rec {
pname = "nomadnet"; pname = "nomadnet";
version = "1.1.1"; version = "1.1.1";
format = "setuptools"; format = "setuptools";
src = pyPkgs.fetchPypi { src = pyPkgs.fetchPypi {
inherit pname version; inherit pname version;
sha256 = "fa13b64a10e75b705a58024815ab72451700aa726af96d415ba99dec28dfc40a"; sha256 = "fa13b64a10e75b705a58024815ab72451700aa726af96d415ba99dec28dfc40a";
};
propagatedBuildInputs = with pyPkgs; [ final.reticulumStack final.lxmf urwid qrcode ];
doCheck = false;
pythonImportsCheck = [ "nomadnet" ];
meta = with final.lib; {
description = "Nomad Network resilient mesh communications platform";
homepage = "https://github.com/markqvist/NomadNet";
license = licenses.mit;
platforms = platforms.linux;
};
}; };
propagatedBuildInputs = with pyPkgs; [ final.reticulumStack final.lxmf urwid qrcode ];
doCheck = false;
pythonImportsCheck = [ "nomadnet" ];
meta = with final.lib; {
description = "Nomad Network resilient mesh communications platform";
homepage = "https://github.com/markqvist/NomadNet";
license = licenses.mit;
platforms = platforms.linux;
};
};
rnsh = python3.pkgs.buildPythonApplication rec { rnsh = python3.pkgs.buildPythonApplication rec {
pname = "rnsh"; pname = "rnsh";
version = "0.1.7"; version = "0.1.7";
format = "setuptools"; format = "setuptools";
src = pyPkgs.fetchPypi { src = pyPkgs.fetchPypi {
inherit pname version; inherit pname version;
sha256 = "9cb72f25abb1c6d300f8014b264184ff78f592fe88e36094938012990b797c93"; sha256 = "9cb72f25abb1c6d300f8014b264184ff78f592fe88e36094938012990b797c93";
};
propagatedBuildInputs = [ final.reticulumStack ];
doCheck = false;
pythonImportsCheck = [ "rnsh" ];
meta = with final.lib; {
description = "Remote shell over Reticulum";
homepage = "https://github.com/acehoss/rnsh";
license = licenses.mit;
platforms = platforms.linux;
};
}; };
propagatedBuildInputs = [ final.reticulumStack ]; }
doCheck = false; # meshtastic may not exist in all nixpkgs versions (e.g. not in 25.11)
pythonImportsCheck = [ "rnsh" ]; // prev.lib.optionalAttrs (prev ? meshtastic) {
meta = with final.lib; { inherit (prev) meshtastic;
description = "Remote shell over Reticulum"; }
homepage = "https://github.com/acehoss/rnsh";
license = licenses.mit;
platforms = platforms.linux;
};
};
}
# meshtastic may not be in all nixpkgs versions (not in 25.11 stable)
// optionalAttrs (builtins.hasAttr "meshtastic" prev) {
meshtastic = prev.meshtastic.overrideAttrs (old: {
dontCheckRuntimeDeps = true;
});
}