From 2b89ff44c320bd9bd98c6dcb1e98cf36f6905b53 Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Mon, 16 Nov 2026 11:02:19 -0500 Subject: [PATCH] fix(nixos,deployments): wire HOMELAB_STATE_ROOT in daemon env and retire docs target - Set HOMELAB_STATE_ROOT=/home//var/lib/homelab in homelab-appctl and homelab-gitops systemd environments so sandboxed HOME=/var/lib/homelab/appctl does not break state containment checks - Remove retired docs (homelab-doc2site) entry from config/deployments.yaml - Set HOMELAB_DEPLOYMENTS_FILE hermetically in test_appctl_daemon.py daemon_env fixture --- config/deployments.yaml | 5 ----- nixos/modules/homeserver.nix | 2 ++ tests/unit/test_appctl_daemon.py | 1 + 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/config/deployments.yaml b/config/deployments.yaml index 5337311..d7b760e 100644 --- a/config/deployments.yaml +++ b/config/deployments.yaml @@ -21,11 +21,6 @@ repositories: aliases: - "homelab-jellyfin" - "media" - docs: - path: "~/Sites/homelab-doc2site" - aliases: - - "doc2site" - - "homelab-doc2site" courses: path: "~/Sites/courses" aliases: diff --git a/nixos/modules/homeserver.nix b/nixos/modules/homeserver.nix index 3be8fba..640ff99 100644 --- a/nixos/modules/homeserver.nix +++ b/nixos/modules/homeserver.nix @@ -123,6 +123,7 @@ GITOPS_SECRET_FILE = config.sops.secrets."gitops/webhook_secret".path; GITOPS_APPCTL_TOKEN_FILE = config.sops.secrets."gitops/appctl_token".path; DOCKER_CONFIG = "/home/${config.homelab.operatorUser}/.local/state/homelab/docker"; + HOMELAB_STATE_ROOT = "/home/${config.homelab.operatorUser}/var/lib/homelab"; }; serviceConfig = { @@ -199,6 +200,7 @@ APPCTL_TOKENS_FILE = config.sops.secrets."appctl/tokens_json".path; SITES_DIR = config.homelab.sitesDir; CORE_DIR = config.homelab.coreDir; + HOMELAB_STATE_ROOT = "/home/${config.homelab.operatorUser}/var/lib/homelab"; HOMELAB_CONFIG_DIR = "/home/${config.homelab.operatorUser}/.config/homelab"; HOMELAB_DEPLOYMENTS_FILE = "${config.homelab.coreDir}/config/deployments.yaml"; }; diff --git a/tests/unit/test_appctl_daemon.py b/tests/unit/test_appctl_daemon.py index 9f8b0d0..56106ff 100644 --- a/tests/unit/test_appctl_daemon.py +++ b/tests/unit/test_appctl_daemon.py @@ -153,6 +153,7 @@ def daemon_env(tmp_path: Path, monkeypatch: pytest.MonkeyPatch): f' path: "{docs_dir}"\n', encoding="utf-8", ) + monkeypatch.setenv("HOMELAB_DEPLOYMENTS_FILE", str(deployments_file)) router = OperationalRouter( audit_logger=audit_logger,