From 9ad581f0e5d1131beac5286e760a5ec888877f33 Mon Sep 17 00:00:00 2001 From: mjallen18 Date: Mon, 16 Mar 2026 17:20:16 -0500 Subject: [PATCH] nuc --- .../services/esphome/default.nix | 39 +++++------------- packages/python/fatfs-ng/default.nix | 40 ------------------- packages/python/littlefs-python/default.nix | 33 --------------- systems/x86_64-linux/nuc-nixos/default.nix | 2 +- 4 files changed, 12 insertions(+), 102 deletions(-) delete mode 100644 packages/python/fatfs-ng/default.nix delete mode 100644 packages/python/littlefs-python/default.nix diff --git a/modules/nixos/homeassistant/services/esphome/default.nix b/modules/nixos/homeassistant/services/esphome/default.nix index 2ea4144..a93722d 100644 --- a/modules/nixos/homeassistant/services/esphome/default.nix +++ b/modules/nixos/homeassistant/services/esphome/default.nix @@ -1,45 +1,28 @@ { config, lib, - pkgs, namespace, ... }: with lib; let cfg = config.${namespace}.services.home-assistant; - - # ESPHome with littlefs-python and fatfs-ng added to PYTHONPATH so PlatformIO's - # espressif32 platform builder can import them (needed for LittleFS/FAT support). - # fatfs-ng is the correct package: it installs under the 'fatfs' namespace and - # provides create_extended_partition and ESP32 wear-leveling support required by - # pioarduino's platform builder (penv_setup.py specifies "fatfs-ng>=0.1.14"). - esphomeWithLittlefs = pkgs.esphome.overridePythonAttrs (oldAttrs: { - makeWrapperArgs = (oldAttrs.makeWrapperArgs or [ ]) ++ [ - "--prefix PYTHONPATH : ${pkgs.${namespace}.littlefs-python}/${pkgs.python3.sitePackages}" - "--prefix PYTHONPATH : ${pkgs.${namespace}.fatfs-ng}/${pkgs.python3.sitePackages}" - ]; - }); in { config = mkIf cfg.enable { - services = { - esphome = { - enable = true; - openFirewall = true; # 6052 - address = "0.0.0.0"; - package = esphomeWithLittlefs; + virtualisation.oci-containers.containers.esphome = { + autoStart = true; + image = "ghcr.io/esphome/esphome:2026.2.4"; + ports = [ "6052:6052" ]; + volumes = [ + "/var/lib/esphome:/config" + ]; + environment = { + TZ = "America/Chicago"; }; }; - # Add uv to the ESPHome service PATH so PlatformIO uses the Nix-provided - # binary instead of downloading its own (which would fail due to permissions). - # Also disable MemoryDenyWriteExecute so uv (a native Rust binary) can run. - systemd.services.esphome = { - path = [ pkgs.uv ]; - serviceConfig = { - MemoryDenyWriteExecute = lib.mkForce false; - }; - }; + # Open the ESPHome dashboard port + networking.firewall.allowedTCPPorts = [ 6052 ]; }; } diff --git a/packages/python/fatfs-ng/default.nix b/packages/python/fatfs-ng/default.nix deleted file mode 100644 index 67f2b48..0000000 --- a/packages/python/fatfs-ng/default.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ - lib, - python3Packages, -}: - -python3Packages.buildPythonPackage rec { - pname = "fatfs-ng"; - version = "0.1.15"; - format = "setuptools"; - - src = python3Packages.fetchPypi { - pname = "fatfs_ng"; - inherit version; - hash = "sha256-qwSMf3s8+IxVi6mHEWr8vYa6/bMUXcaGWhULUMaADAs="; - }; - - # wrapper.c is pre-generated in the sdist; Cython is not needed at build time. - # Patch out setup_requires=['cython'] to prevent setuptools from trying to - # fetch it via pip at build time (which fails in the Nix sandbox). - postPatch = '' - substituteInPlace setup.py \ - --replace-fail "setup_requires=['cython']," "" - ''; - - nativeBuildInputs = with python3Packages; [ - setuptools - ]; - - doCheck = false; - - # fatfs-ng installs under the 'fatfs' namespace (ext_package='fatfs') - pythonImportsCheck = [ "fatfs" ]; - - meta = with lib; { - description = "Enhanced Python wrapper around ChaN's FatFS library with ESP32 wear-leveling support"; - homepage = "https://github.com/Jason2866/pyfatfs"; - license = licenses.mit; - maintainers = [ ]; - }; -} diff --git a/packages/python/littlefs-python/default.nix b/packages/python/littlefs-python/default.nix deleted file mode 100644 index f9db988..0000000 --- a/packages/python/littlefs-python/default.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - lib, - python3Packages, -}: - -python3Packages.buildPythonPackage rec { - pname = "littlefs-python"; - version = "0.17.1"; - pyproject = true; - - src = python3Packages.fetchPypi { - pname = "littlefs_python"; - inherit version; - hash = "sha256-O8D9Tnf5T6ZVlRdRfPqj38dCUkcayW4a5fWQaJ4ErtA="; - }; - - build-system = with python3Packages; [ - setuptools - setuptools-scm - cython - ]; - - doCheck = false; - - pythonImportsCheck = [ "littlefs" ]; - - meta = with lib; { - description = "Python bindings for littlefs, the filesystem designed for small embedded targets"; - homepage = "https://github.com/jrast/littlefs-python"; - license = licenses.mit; - maintainers = [ ]; - }; -} diff --git a/systems/x86_64-linux/nuc-nixos/default.nix b/systems/x86_64-linux/nuc-nixos/default.nix index cda9f0b..b8386e4 100644 --- a/systems/x86_64-linux/nuc-nixos/default.nix +++ b/systems/x86_64-linux/nuc-nixos/default.nix @@ -31,7 +31,7 @@ impermanence = { enable = true; extraDirectories = [ - "/var/lib/private/esphome" + "/var/lib/esphome" "/var/lib/homeassistant" "/var/lib/mosquitto" "/var/lib/music-assistant"