From 355f5eb9f185e44e300aed414bab6b398ce106c0 Mon Sep 17 00:00:00 2001 From: mikl Date: Mon, 13 Jul 2026 15:40:07 +0300 Subject: [PATCH] poppy: add pi -> 127.0.0.1 alias for local pi-web MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Декларативное правило в /etc/hosts через extraActivation, чтобы работала короткая ссылка http://pi:30141 на локальный pi-web (@agegr/pi-web, порт 30141). Идемпотентно. --- hosts/poppy/default.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hosts/poppy/default.nix b/hosts/poppy/default.nix index 2d03646..cf6ccb3 100644 --- a/hosts/poppy/default.nix +++ b/hosts/poppy/default.nix @@ -2,6 +2,18 @@ imports = [ ./apps.nix ./system.nix ]; networking.hostName = "poppy"; + + # Локальное короткое имя pi -> 127.0.0.1 для pi-web. + # Запуск: npm exec @agegr/pi-web@latest --hostname 0.0.0.0 --port 30141 + # Ссылка: http://pi:30141 + # (networking.hosts в nix-darwin отсутствует; /etc/hosts правится + # идемпотентно через extraActivation — один из хуков, реально + # вызываемых в activate-скрипте.) + system.activationScripts.extraActivation.text = '' + if ! grep -qE '^[0-9.]+[[:space:]]+pi($|[[:space:]])' /etc/hosts; then + printf '127.0.0.1\tpi # pi-web local alias\n' >> /etc/hosts + fi + ''; system.primaryUser = "mikl"; system.stateVersion = 7;