Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61a2798d4f | ||
|
|
2bf0635ba9 |
No files matched your search
@@ -1,9 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -euo pipefail
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# Homelab Core Pre-Commit Invariant & Quality Gate Hook
|
# Homelab Core Pre-Commit Invariant & Quality Gate Hook
|
||||||
# Runs linter (Ruff) and architecture & security test suite (Pytest)
|
# Runs linter (Ruff), static type checker (Pyright), and test suite (Pytest)
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
@@ -13,26 +13,24 @@ echo "🔍 [pre-commit] Executing Homelab Core invariant checks..."
|
|||||||
|
|
||||||
# 1. Run Ruff Linter
|
# 1. Run Ruff Linter
|
||||||
echo " ↳ Linting repository with Ruff..."
|
echo " ↳ Linting repository with Ruff..."
|
||||||
if command -v uv >/dev/null 2>&1; then
|
if command -v ruff >/dev/null 2>&1; then
|
||||||
uv run ruff check .
|
|
||||||
elif command -v ruff >/dev/null 2>&1; then
|
|
||||||
ruff check .
|
ruff check .
|
||||||
elif command -v nix >/dev/null 2>&1 && [ -f flake.nix ]; then
|
elif command -v nix >/dev/null 2>&1 && [ -f flake.nix ]; then
|
||||||
nix develop --command ruff check .
|
nix develop --command ruff check .
|
||||||
else
|
else
|
||||||
echo "⚠️ [pre-commit] Neither uv, ruff, nor nix found; skipping ruff"
|
echo "⚠️ [pre-commit] Neither ruff nor nix found; skipping ruff"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 2. Run Pytest Suite
|
# 2. Run Pytest Suite
|
||||||
echo " ↳ Running structural and security test suite with Pytest..."
|
echo " ↳ Running structural and security test suite with Pytest..."
|
||||||
if command -v uv >/dev/null 2>&1; then
|
if [ -x ".venv/bin/pytest" ]; then
|
||||||
uv run --with pytest --with pyyaml pytest tests/
|
.venv/bin/pytest tests/
|
||||||
elif command -v pytest >/dev/null 2>&1; then
|
elif command -v pytest >/dev/null 2>&1; then
|
||||||
pytest tests/
|
pytest tests/
|
||||||
elif command -v nix >/dev/null 2>&1 && [ -f flake.nix ]; then
|
elif command -v nix >/dev/null 2>&1 && [ -f flake.nix ]; then
|
||||||
nix develop --command pytest tests/
|
nix develop --command pytest tests/
|
||||||
else
|
else
|
||||||
echo "⚠️ [pre-commit] Neither uv, pytest, nor nix found; skipping pytest"
|
echo "⚠️ [pre-commit] Neither pytest nor nix found; skipping pytest"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "✅ [pre-commit] All repository checks passed successfully!"
|
echo "✅ [pre-commit] All repository checks passed successfully!"
|
||||||
@@ -5,6 +5,7 @@ secrets.txt
|
|||||||
backup.zip
|
backup.zip
|
||||||
.envrc
|
.envrc
|
||||||
.direnv
|
.direnv
|
||||||
|
.venv
|
||||||
|
|
||||||
# SSL / ACME Certificates & Keys
|
# SSL / ACME Certificates & Keys
|
||||||
config/letsencrypt/*
|
config/letsencrypt/*
|
||||||
|
|||||||
@@ -1,79 +1,91 @@
|
|||||||
# Homelab Core — Agent Guidelines
|
# Homelab Core — Agent Guidelines
|
||||||
|
|
||||||
This repository defines the declarative NixOS host foundation, shared infrastructure services, security boundaries, and the `appctl` operational control plane. Independent application workloads live in `~/Sites` and integrate through declarative `app.yaml` manifests and Docker Compose definitions.
|
## 1. Project Overview & Architectural Boundaries
|
||||||
|
|
||||||
---
|
**Homelab Core** defines the declarative NixOS host foundation, shared platform infrastructure services, security boundaries, and the `appctl` operational control plane. Independent application workloads live in `~/Sites/<app>` and integrate through declarative `app.yaml` manifests and workload-scoped Docker Compose files.
|
||||||
|
|
||||||
## 1. Context Discovery & Hierarchy of Truth
|
### Core vs. `~/Sites` Ownership
|
||||||
|
- **Core owns**: NixOS host configuration, shared platform services (edge ingress, SSO/LDAP, mail, log/update monitors), platform-level ports and security policy, and orchestration/deployment mechanics.
|
||||||
|
- **`~/Sites` owns**: Independently deployed application workloads, workload-specific `docker-compose.yml` topologies, and workload intent (`app.yaml`).
|
||||||
|
- **Boundary Rule**: Never hardcode *workload-specific* domains, ports, containers, environment variables, or deployment policies in Core (`scripts/appctl*`, GitOps, or Core `docker-compose.yml`), and never move Core platform services into `~/Sites`. When ownership is ambiguous, consult [`docs/architecture.md`](docs/architecture.md) before changing the boundary.
|
||||||
|
|
||||||
|
### Context Discovery Hierarchy
|
||||||
Before proposing or implementing changes, establish context in this order:
|
Before proposing or implementing changes, establish context in this order:
|
||||||
1. **Architectural Decisions (`docs/decisions/`)**: Check [`docs/decisions/README.md`](docs/decisions/README.md) and local ADRs for binding design commitments.
|
1. **Architectural Decisions (`docs/decisions/`)**: Check [`docs/decisions/README.md`](docs/decisions/README.md) and local ADRs for binding design commitments.
|
||||||
2. **Architecture & Contracts (`docs/`)**: Consult [`docs/architecture.md`](docs/architecture.md), [`docs/appctl.md`](docs/appctl.md), [`docs/gitops.md`](docs/gitops.md), and [`docs/secrets-and-state.md`](docs/secrets-and-state.md) for current runtime behavior.
|
2. **Runtime Contracts (`docs/`)**: Consult [`docs/architecture.md`](docs/architecture.md), [`docs/appctl.md`](docs/appctl.md), [`docs/gitops.md`](docs/gitops.md), and [`docs/secrets-and-state.md`](docs/secrets-and-state.md) for current behavior.
|
||||||
3. **Trajectory & Active Work (`ROADMAP.md`, `todo.txt`, `git log`)**: Verify milestone scope, active tasks, and recent commit history before modifying adjacent subsystems.
|
3. **Trajectory & Active Work (`ROADMAP.md`, `todo.txt`, `git log`)**: Verify whether a capability belongs to the current baseline or a planned milestone before modifying code.
|
||||||
|
|
||||||
When a requested change conflicts with an architectural invariant or accepted ADR, **stop and surface the conflict** before implementing a workaround.
|
When a requested change conflicts with an architectural invariant or accepted ADR, **stop and surface the conflict** before implementing a workaround.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 2. Architectural Invariants
|
## 2. Build, Lint & Verification Commands
|
||||||
|
|
||||||
1. **Core / Sites Boundary**:
|
The Python environment (`python3`, `pytest`, `pydantic`, `pyyaml`, `types-pyyaml`) and static analysis tools (`ruff`, `pyright`) are provisioned hermetically by `flake.nix` and automatically symlinked to `.venv` via the Nix `devShell` hook (`.envrc`). Do not create separate `uv` or `pip` virtual environments that split from the Nix store environment.
|
||||||
- **Core owns**: NixOS host configuration, shared platform services (ingress, SSO/LDAP, mail, monitoring), security policy, and deployment mechanics.
|
|
||||||
- **`~/Sites` owns**: Application workloads, workload-specific `docker-compose.yml`, and workload intent (`app.yaml`).
|
|
||||||
- Never hardcode workload-specific domains, ports, containers, or policies in Core (`scripts/appctl*`, GitOps), and never move Core platform services into `~/Sites`.
|
|
||||||
2. **Declarative Workload Manifests (`app.yaml`)**:
|
|
||||||
- Workloads are self-describing via strict, fail-closed Pydantic v2 schemas (`scripts/core_manifest.py`).
|
|
||||||
- Never introduce arbitrary command execution, host filesystem paths, privileged flags, or Docker control capabilities into `app.yaml`.
|
|
||||||
3. **GitOps Trust Boundary**:
|
|
||||||
- Webhook admission requires cryptographic authentication (HMAC-SHA256).
|
|
||||||
- Repository identity and filesystem paths are resolved strictly through trusted Core logic (`config/deployments.yaml`)—never directly from webhook payloads.
|
|
||||||
- Execution must remain allowlisted, serialized (`flock`), and free of shell interpolation (`shell=False`).
|
|
||||||
4. **Docker & Privilege Isolation**:
|
|
||||||
- `socket-proxy` is the **only** container permitted to mount `/var/run/docker.sock` (strictly `:ro`, read-only API capabilities only).
|
|
||||||
- Never add `privileged: true`, host namespace sharing, or direct Docker socket mounts to workload or control-plane containers.
|
|
||||||
5. **Secrets & Runtime State**:
|
|
||||||
- Never commit plaintext secrets, keys, hashes, certificates, or runtime databases.
|
|
||||||
- Host secrets are managed via SOPS (`sops-nix`) and projected to `/run/secrets/`. Persistent mutable state lives outside Git in dedicated state directories or Docker volumes.
|
|
||||||
6. **Platform Genericism & License**:
|
|
||||||
- Keep all code, templates, tests, and documentation strictly instance-agnostic. Inject domains and identities at runtime (`HOMELAB_DOMAIN`, `DOMAIN_SUFFIX`).
|
|
||||||
- Use RFC 2606 placeholders (`example.com`, `example.org`, `example.test`) in tests and documentation—never personal domains or operator usernames.
|
|
||||||
- Preserve [The Unlicense](UNLICENSE) across the repository.
|
|
||||||
|
|
||||||
---
|
Every implementation step must close with the automated verification gate before proposing a commit:
|
||||||
|
|
||||||
## 3. Engineering Practices & TDD
|
|
||||||
|
|
||||||
- **TDD-First**: Write or update failing unit, structural, or security tests in `tests/` before or alongside implementation changes.
|
|
||||||
- **No Tautological Tests**: Every test must import and execute real production code or scripts and assert on observable outcomes. Never write tests that only inspect local mock strings, hardcode expected results into the fixture under test, or pass when the production invariant is broken.
|
|
||||||
- **Fail-Closed Contracts**: Validate external inputs (YAML manifests, webhook payloads, CLI arguments, subprocess outputs) through strict schemas and explicit error paths. Never swallow diagnostic `stderr` silently.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 4. Step Closure & Verification Gate
|
|
||||||
|
|
||||||
Every implementation step must close with automated verification before proposing a commit:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./scripts/test # Ruff linter + Pytest suite + nix flake check + NixOS drv eval
|
# Full verification gate: Ruff + Pyright + Pytest (124+ tests) + nix flake check + NixOS drv eval
|
||||||
nix develop --command pyright # Static type analysis across Python scripts and tests
|
./scripts/test
|
||||||
|
|
||||||
|
# Targeted fast iteration commands (inside direnv / nix develop, or via .venv)
|
||||||
|
ruff check .
|
||||||
|
pyright
|
||||||
|
.venv/bin/pytest tests/
|
||||||
```
|
```
|
||||||
|
|
||||||
Run context-specific validation when modifying container or service definitions:
|
When modifying container or Compose definitions, also validate Compose syntax:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker compose config -q
|
docker compose config -q
|
||||||
```
|
```
|
||||||
|
|
||||||
Do not bypass failing tests by weakening or removing an invariant test unless the architecture itself has intentionally changed via an approved decision.
|
---
|
||||||
|
|
||||||
|
## 3. Code Style & Contract Guidelines
|
||||||
|
|
||||||
|
- **Fail-Closed Validation (`scripts/core_manifest.py`)**: All external inputs (`app.yaml` manifests, webhook payloads, CLI arguments, daemon payloads) must be validated through strict Pydantic v2 models (`ConfigDict(extra="forbid")`).
|
||||||
|
- **Explicit Error Handling**: Never swallow diagnostic `stderr` silently (e.g., avoid blind `2>/dev/null` on engine or manifest commands). Surface actionable validation errors while redacting sensitive material.
|
||||||
|
- **Platform Genericism**: Keep all code, templates, tests, and documentation strictly instance-agnostic:
|
||||||
|
- Inject routing and service identities at runtime via environment variables (`HOMELAB_DOMAIN`, `DOMAIN_SUFFIX`).
|
||||||
|
- Use RFC 2606 placeholders (`example.com`, `example.org`, `example.test`) in tests and configuration examples—never personal domains or operator usernames.
|
||||||
|
- In historical documentation or milestone records, use descriptive phrasing (e.g., *"the configured `smtp.<domain>` endpoint"*) rather than fabricating placeholder domains as historical facts.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 5. Internal Documentation & Git Hygiene
|
## 4. Testing Instructions (TDD)
|
||||||
|
|
||||||
- **Repository Documentation (`docs/`)**: Keep documentation concise, accurate to current code reality, and formatted in GitHub-Flavored Markdown compatible with Obsidian.
|
- **TDD-First**: Write or update failing unit, structural, or security tests in `tests/` before or alongside implementation changes.
|
||||||
|
- **No Tautological Tests**: Every test must import and execute real production modules or scripts (`core_manifest`, `appctl_engine`, `gitops_dispatcher`, `scripts/appctl`) and assert on observable outcomes. Never write tests that only inspect local mock strings, hardcode expected outputs into the fixture under test, or continue passing when the production invariant is broken.
|
||||||
|
- **Protect Invariants**: Do not bypass failing tests by weakening or deleting an invariant assertion unless the architecture itself has intentionally changed via an approved ADR.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Security & State Invariants
|
||||||
|
|
||||||
|
1. **Workload Manifests (`app.yaml`)**: Describe declarative workload identity, routing metadata, and deployment intent only. Never introduce arbitrary command execution, host filesystem paths, privileged flags, or Docker control capabilities into `app.yaml`.
|
||||||
|
2. **GitOps Trust Boundary (`scripts/gitops_dispatcher.py`)**:
|
||||||
|
- Webhook admission requires cryptographic authentication (HMAC-SHA256).
|
||||||
|
- Repository identity and filesystem paths must be resolved strictly through trusted Core configuration (`config/deployments.yaml`)—never directly from webhook payloads.
|
||||||
|
- Execution must remain allowlisted, serialized (`flock`), pre-validated by the Compose AST security checker, and free of shell interpolation (`shell=False`, no `eval`).
|
||||||
|
3. **Docker & Privilege Isolation**:
|
||||||
|
- `socket-proxy` is the **only** service permitted to mount `/var/run/docker.sock` (strictly `:ro`, read-only API capabilities only; `POST=0`, `DELETE=0`, `BUILD=0`, `EXEC=0`).
|
||||||
|
- Never add `privileged: true`, host namespace sharing, or direct Docker socket mounts to workload or control-plane containers.
|
||||||
|
4. **Declarative Configuration vs. Secrets & Runtime State**:
|
||||||
|
- Git stores declarative configuration and reproducible definitions only. Never commit plaintext secrets, keys, password hashes, certificates, or runtime databases.
|
||||||
|
- Host secrets are managed via SOPS (`sops-nix`) and projected to `/run/secrets/`.
|
||||||
|
- Persistent mutable runtime state belongs in dedicated host state directories (`~/var/lib/homelab/<app>/`) or Docker volumes excluded from version control.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. Documentation, Task Tracking & Git Workflow
|
||||||
|
|
||||||
|
- **Synchronize Documentation (`docs/`)**: Update repository documentation alongside code changes that alter behavior, contracts, or operations. Keep all Markdown formatted in GitHub-Flavored Markdown compatible with both Obsidian and the live documentation viewer.
|
||||||
- **Architecture Decision Records (`docs/decisions/`)**: Record binding repository-level architectural decisions in MADR 4.0 format (`NNNN-slug.md`) and register them in [`docs/decisions/README.md`](docs/decisions/README.md).
|
- **Architecture Decision Records (`docs/decisions/`)**: Record binding repository-level architectural decisions in MADR 4.0 format (`NNNN-slug.md`) and register them in [`docs/decisions/README.md`](docs/decisions/README.md).
|
||||||
- **Task Tracking (`todo.txt`)**: Maintain a comment-free root `todo.txt` formatted for `tuxedo` / `todo.sh` (`(A)`–`(C)` priorities, `+<project>`, `@<context>`). Mark verified deliverables completed (`x YYYY-MM-DD ...`) immediately.
|
- **Live Task Tracking (`todo.txt`)**: Maintain a comment-free root `todo.txt` formatted for `tuxedo` / `todo.sh` (`(A)`–`(C)` priorities, `+<project>`, `@<context>`) reflecting the current milestone. Mark verified deliverables completed (`x YYYY-MM-DD ...`) immediately.
|
||||||
- **Git & Commits**:
|
- **Git & Commits**:
|
||||||
- Never commit directly to `main`/`master`.
|
- Never commit directly to `main`/`master`.
|
||||||
- Never run destructive Git commands (`reset --hard`, `restore`, `clean -fd`, `push --force`) without explicit user confirmation.
|
- Never run destructive Git commands (`reset --hard`, `restore`, `clean -fd`, `push --force`) without explicit user confirmation.
|
||||||
- Stage atomic changes and use Conventional Commits (`feat`, `fix`, `refactor`, `test`, `docs`, `chore`), waiting for user approval before committing.
|
- Stage atomic changes and use Conventional Commits (`feat`, `fix`, `refactor`, `test`, `docs`, `chore`), waiting for user approval before committing.
|
||||||
|
- Preserve [The Unlicense](UNLICENSE) across the repository.
|
||||||
@@ -8,6 +8,9 @@ It is designed around a strict two-tier boundary:
|
|||||||
|
|
||||||
All platform definitions are strictly instance-agnostic; domain names (`HOMELAB_DOMAIN`) and secrets (`/run/secrets/`) are injected declaratively at runtime.
|
All platform definitions are strictly instance-agnostic; domain names (`HOMELAB_DOMAIN`) and secrets (`/run/secrets/`) are injected declaratively at runtime.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> **Current Implementation Baseline vs. Target Architecture**: This README documents the **currently implemented CLI and runtime baseline (Milestone P3)**. Under [Milestone P4 in `ROADMAP.md`](ROADMAP.md), `appctl` is transitioning from a host CLI orchestrator into a dedicated daemon service (`homelab-appctl.service`) exposing a unified logical API across local Unix socket and HTTP transports. See [`ROADMAP.md`](ROADMAP.md) for the full baseline-to-target matrix.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## System Architecture at a Glance
|
## System Architecture at a Glance
|
||||||
@@ -34,7 +37,7 @@ All platform definitions are strictly instance-agnostic; domain names (`HOMELAB_
|
|||||||
│ Dozzle, Stalwart, etc.) │
|
│ Dozzle, Stalwart, etc.) │
|
||||||
│ • Workload Apps (~/Sites/*) │
|
│ • Workload Apps (~/Sites/*) │
|
||||||
└───────────────┬───────────────┘
|
└───────────────┬───────────────┘
|
||||||
│ (Protected API via TCP:2375)
|
│ (Read-Only API via TCP:2375)
|
||||||
▼
|
▼
|
||||||
┌───────────────────────────────┐
|
┌───────────────────────────────┐
|
||||||
│ Docker socket-proxy │
|
│ Docker socket-proxy │
|
||||||
@@ -43,14 +46,23 @@ All platform definitions are strictly instance-agnostic; domain names (`HOMELAB_
|
|||||||
│ (read-only mount :ro)
|
│ (read-only mount :ro)
|
||||||
▼
|
▼
|
||||||
/var/run/docker.sock
|
/var/run/docker.sock
|
||||||
|
▲
|
||||||
|
│ (Host Orchestration & CD)
|
||||||
|
┌───────────────┴───────────────┐
|
||||||
|
│ Host Control Plane Baseline │
|
||||||
|
│ • appctl CLI + Engine │
|
||||||
|
│ • homelab-gitops.service │
|
||||||
|
└───────────────────────────────┘
|
||||||
```
|
```
|
||||||
|
|
||||||
|
For detailed runtime layers, network segmentation, and the P4 control-plane transport architecture, see [`docs/architecture.md`](docs/architecture.md) and [`ROADMAP.md`](ROADMAP.md).
|
||||||
|
|
||||||
### Core Platform Services (`docker-compose.yml`)
|
### Core Platform Services (`docker-compose.yml`)
|
||||||
|
|
||||||
| Service | Default Endpoint | Role | Access Policy |
|
| Service | Default Endpoint | Role | Access Policy |
|
||||||
| :--- | :--- | :--- | :--- |
|
| :--- | :--- | :--- | :--- |
|
||||||
| **`traefik`** | `traefik.${HOMELAB_DOMAIN}` | Edge reverse proxy & DNS-01 ACME wildcard TLS | Authelia Guard |
|
| **`traefik`** | `traefik.${HOMELAB_DOMAIN}` | Edge reverse proxy & DNS-01 ACME wildcard TLS | Authelia Guard |
|
||||||
| **`socket-proxy`** | Internal (`socket-net:2375`) | Read-only Docker API security barrier (`POST=0`) | Internal Only |
|
| **`socket-proxy`** | Internal (`socket-net:2375`) | Read-only Docker API security barrier (`POST=0`, `DELETE=0`) | Internal Only |
|
||||||
| **`lldap`** | `users.${HOMELAB_DOMAIN}` | Central LDAP user directory | Authelia Guard |
|
| **`lldap`** | `users.${HOMELAB_DOMAIN}` | Central LDAP user directory | Authelia Guard |
|
||||||
| **`authelia`** | `auth.${HOMELAB_DOMAIN}` | Single Sign-On (SSO), 2FA & ForwardAuth | Public (Auth Endpoint) |
|
| **`authelia`** | `auth.${HOMELAB_DOMAIN}` | Single Sign-On (SSO), 2FA & ForwardAuth | Public (Auth Endpoint) |
|
||||||
| **`stalwart`** | `smtp.${HOMELAB_DOMAIN}` | Mail server (SMTP/IMAP/JMAP/Sieve) | Native / LLDAP |
|
| **`stalwart`** | `smtp.${HOMELAB_DOMAIN}` | Mail server (SMTP/IMAP/JMAP/Sieve) | Native / LLDAP |
|
||||||
@@ -65,7 +77,7 @@ All platform definitions are strictly instance-agnostic; domain names (`HOMELAB_
|
|||||||
|
|
||||||
```text
|
```text
|
||||||
.
|
.
|
||||||
├── flake.nix # NixOS host configuration, devShell, and sandboxed CI checks
|
├── flake.nix # NixOS host configuration, devShell (.venv symlink), and CI checks
|
||||||
├── docker-compose.yml # Core platform service stack
|
├── docker-compose.yml # Core platform service stack
|
||||||
├── nixos/ # Declarative NixOS modules, systemd units, and SOPS secret wiring
|
├── nixos/ # Declarative NixOS modules, systemd units, and SOPS secret wiring
|
||||||
├── config/ # Service configurations (Traefik, Authelia, Homepage, deployments.yaml)
|
├── config/ # Service configurations (Traefik, Authelia, Homepage, deployments.yaml)
|
||||||
@@ -74,29 +86,30 @@ All platform definitions are strictly instance-agnostic; domain names (`HOMELAB_
|
|||||||
│ ├── appctl_engine.py # Discovery, two-axis provenance, TLS inspection, and Homepage sync engine
|
│ ├── appctl_engine.py # Discovery, two-axis provenance, TLS inspection, and Homepage sync engine
|
||||||
│ ├── core_manifest.py # Authoritative Pydantic v2 schema v1.0 parser for workload app.yaml
|
│ ├── core_manifest.py # Authoritative Pydantic v2 schema v1.0 parser for workload app.yaml
|
||||||
│ ├── gitops_dispatcher.py # Authenticated webhook CD engine with Compose AST security validation
|
│ ├── gitops_dispatcher.py # Authenticated webhook CD engine with Compose AST security validation
|
||||||
│ └── test # Automated verification runner (Ruff, Pytest, Nix flake checks)
|
│ └── test # Automated verification gate (Ruff, Pyright, Pytest, Nix flake checks)
|
||||||
├── tests/ # Unit, structural, and security invariant test suites
|
├── tests/ # Unit, structural, and security invariant test suites
|
||||||
└── docs/ # Architecture references, operational runbooks, and MADR decisions
|
└── docs/ # Architecture references, operational runbooks, and MADR decisions
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Quickstart & Operations
|
## Quickstart & Operations (Current CLI Baseline)
|
||||||
|
|
||||||
### Development & Verification
|
### Development & Verification
|
||||||
|
|
||||||
```bash
|
Entering the directory via `direnv` (`use flake`) or `nix develop` provisions the hermetic Nix Python environment and symlinks `.venv` for IDE static analysis:
|
||||||
# Enter the hermetic Nix development shell (Python 3, Pytest, Pydantic, PyYAML, Ruff, Pyright)
|
|
||||||
nix develop
|
|
||||||
|
|
||||||
# Run full automated verification (Ruff linter + Pytest suite + nix flake check + NixOS eval)
|
```bash
|
||||||
|
# Run full automated verification (Ruff + Pyright + Pytest + nix flake check + NixOS drv eval)
|
||||||
./scripts/test
|
./scripts/test
|
||||||
|
|
||||||
# Run static type analysis
|
# Run individual checks directly
|
||||||
nix develop --command pyright
|
ruff check .
|
||||||
|
pyright
|
||||||
|
.venv/bin/pytest tests/
|
||||||
```
|
```
|
||||||
|
|
||||||
### Workload Management (`appctl`)
|
### Workload Management (`appctl` CLI)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# List all workloads with container health and local Git checkout status
|
# List all workloads with container health and local Git checkout status
|
||||||
@@ -108,7 +121,7 @@ appctl list --fetch --ssl --core
|
|||||||
# Inspect detailed manifest, provenance, and container diagnostics for a workload
|
# Inspect detailed manifest, provenance, and container diagnostics for a workload
|
||||||
appctl info <service>
|
appctl info <service>
|
||||||
|
|
||||||
# Manage workload or Core service lifecycle
|
# Manage workload or Core service lifecycle (executes docker compose locally in the current baseline)
|
||||||
appctl up <service|core>
|
appctl up <service|core>
|
||||||
appctl down <service|core>
|
appctl down <service|core>
|
||||||
appctl restart <service|core>
|
appctl restart <service|core>
|
||||||
@@ -141,13 +154,13 @@ systemctl status dynu-monitor.service
|
|||||||
| [**`docs/architecture.md`**](docs/architecture.md) | Runtime layers, network segmentation, and Core / `~/Sites` boundaries. |
|
| [**`docs/architecture.md`**](docs/architecture.md) | Runtime layers, network segmentation, and Core / `~/Sites` boundaries. |
|
||||||
| [**`docs/decisions/README.md`**](docs/decisions/README.md) | Architecture Decision Records (MADR 4.0) governing platform evolution. |
|
| [**`docs/decisions/README.md`**](docs/decisions/README.md) | Architecture Decision Records (MADR 4.0) governing platform evolution. |
|
||||||
| [**`ROADMAP.md`**](ROADMAP.md) | Phased engineering milestones (P0–P7) and baseline-to-target architecture matrix. |
|
| [**`ROADMAP.md`**](ROADMAP.md) | Phased engineering milestones (P0–P7) and baseline-to-target architecture matrix. |
|
||||||
| [**`docs/appctl.md`**](docs/appctl.md) | `appctl` CLI commands, resolution hierarchy, and `app.yaml` schema v1.0 contract. |
|
| [**`docs/appctl.md`**](docs/appctl.md) | Current `appctl` CLI commands, resolution hierarchy, and `app.yaml` schema v1.0 contract. |
|
||||||
| [**`docs/gitops.md`**](docs/gitops.md) | Webhook admission pipeline, HMAC verification, Compose AST validation, and locking. |
|
| [**`docs/gitops.md`**](docs/gitops.md) | Webhook admission pipeline, HMAC verification, Compose AST validation, and locking. |
|
||||||
| [**`docs/secrets-and-state.md`**](docs/secrets-and-state.md) | SOPS secret management, `/run/secrets/` projections, and persistent state paths. |
|
| [**`docs/secrets-and-state.md`**](docs/secrets-and-state.md) | SOPS secret management, `/run/secrets/` projections, and persistent state paths. |
|
||||||
| [**`docs/operations.md`**](docs/operations.md) | Day-2 operational runbook, updates, backups, and recovery procedures. |
|
| [**`docs/operations.md`**](docs/operations.md) | Day-2 operational runbook, updates, backups, and recovery procedures. |
|
||||||
| [**`docs/setup_guide.md`**](docs/setup_guide.md) | Bare-metal NixOS installation and host bootstrapping guide. |
|
| [**`docs/setup_guide.md`**](docs/setup_guide.md) | Bare-metal NixOS installation and host bootstrapping guide. |
|
||||||
| [**`SECURITY.md`**](SECURITY.md) | Security controls, Docker socket isolation, and threat model. |
|
| [**`SECURITY.md`**](SECURITY.md) | Security controls, Docker socket isolation, and threat model. |
|
||||||
| [**`AGENTS.md`**](AGENTS.md) | Architectural invariants, TDD rules, and verification gates for AI contributors. |
|
| [**`AGENTS.md`**](AGENTS.md) | Architectural invariants, TDD rules, and verification gates for contributors and agents. |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
+19
-18
@@ -25,12 +25,12 @@ It describes the implementation trajectory and phased engineering milestones for
|
|||||||
| Architectural Area | Current Implementation Baseline (Milestone P3) | Target Architecture (Roadmap v5) |
|
| Architectural Area | Current Implementation Baseline (Milestone P3) | Target Architecture (Roadmap v5) |
|
||||||
| :--- | :--- | :--- |
|
| :--- | :--- | :--- |
|
||||||
| **`appctl` Architecture** | Bash CLI wrapper (`scripts/appctl`) driving local subprocesses (`docker compose`, `git`) and Python engine. | Dedicated daemon service (`homelab-appctl.service`) exposing one logical API over Unix socket and HTTP. |
|
| **`appctl` Architecture** | Bash CLI wrapper (`scripts/appctl`) driving local subprocesses (`docker compose`, `git`) and Python engine. | Dedicated daemon service (`homelab-appctl.service`) exposing one logical API over Unix socket and HTTP. |
|
||||||
| **Operational Auth** | Host Unix permissions; sourcing runtime secrets from `/run/secrets/`. | LLDAP directory identity; explicit user-scoped API tokens for mutating actions; Authelia ForwardAuth for Web. |
|
| **Operational Auth** | Host Unix permissions; sourcing runtime secrets from `/run/secrets/`. | Mandatory auth middleware in daemon (P4 admission gate); LLDAP directory RBAC, user-scoped API tokens, and Authelia ForwardAuth (P5). |
|
||||||
| **Metadata & Schema Engine** | Unified engine (`scripts/appctl_engine.py`) with two-axis provenance and fail-closed Pydantic v2 schema v1.0 parser (`scripts/core_manifest.py`). | Single unified engine embedded directly within the control-plane daemon and HTTP/socket routers. |
|
| **Metadata & Schema Engine** | Unified engine (`scripts/appctl_engine.py`) with two-axis provenance and fail-closed Pydantic v2 schema v1.0 parser (`scripts/core_manifest.py`). | Control-plane daemon invokes `core_manifest.py` / `appctl_engine.py` through a stable internal Python interface. |
|
||||||
| **Deployment Model** | Direct authoring of `app.yaml` and `docker-compose.yml` in `~/Sites/<app>/`. | 5-stage lifecycle: `DeploymentProposal` $\to$ operator-approved `DeploymentModel` in Git $\to$ `appctl` materialization. |
|
| **Deployment Model** | Direct authoring of `app.yaml` and `docker-compose.yml` in `~/Sites/<app>/`. | 5-stage lifecycle (planned in P6): `DeploymentProposal` $\to$ operator-approved `DeploymentModel` in Git $\to$ `appctl` materialization. |
|
||||||
| **GitOps Engine** | Webhook dispatcher (`scripts/gitops_dispatcher.py`) with HMAC-SHA256 auth, Compose AST security validator, and `flock` serialization. | Integrated into control-plane admission, invoking central reconciliation endpoints. |
|
| **GitOps Engine** | Webhook dispatcher (`scripts/gitops_dispatcher.py`) with HMAC-SHA256 auth, Compose AST security validator, and `flock` serialization. | Integrated into control-plane admission, invoking central reconciliation endpoints. |
|
||||||
| **Secret Distribution** | Age-encrypted `nixos/secrets.yaml` decrypted by `sops-nix` to tmpfs `/run/secrets/`. | Host secrets remain in `sops-nix`; workload secrets referenced by key and projected via `SecretProvider`. |
|
| **Secret Distribution** | Age-encrypted `nixos/secrets.yaml` decrypted by `sops-nix` to tmpfs `/run/secrets/`. | Host secrets remain in `sops-nix`; workload secrets referenced by key and projected via `SecretProvider` (planned in P5). |
|
||||||
| **Dashboard** | `appctl sync` compiles `config/homepage/services.yaml` from `app.yaml` manifests. | Homepage consumes read-only live status from `appctl`; dedicated Operations UI client for management. |
|
| **Dashboard** | `appctl sync` compiles `config/homepage/services.yaml` from `app.yaml` manifests. | Homepage consumes read-only live status from `appctl`; dedicated Operations UI client for management (planned in P7). |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -39,11 +39,11 @@ It describes the implementation trajectory and phased engineering milestones for
|
|||||||
| Milestone | Title | Focus Area | Status | Deliverables Summary |
|
| Milestone | Title | Focus Area | Status | Deliverables Summary |
|
||||||
| :--- | :--- | :--- | :--- | :--- |
|
| :--- | :--- | :--- | :--- | :--- |
|
||||||
| **P0** | **Baseline Consolidation** | Git & Architecture | ✅ **Completed** | Synchronized `refactor/appctl-rework` with `main`, recorded control plane ADR, scaffolded v2 metadata engine. |
|
| **P0** | **Baseline Consolidation** | Git & Architecture | ✅ **Completed** | Synchronized `refactor/appctl-rework` with `main`, recorded control plane ADR, scaffolded v2 metadata engine. |
|
||||||
| **P1** | **Mail Topology Realignment** | Topology & State | ✅ **Completed** | Move Stalwart to `smtp.example.com`; migrate SnappyMail to `~/Sites/snappymail` with zero data loss. |
|
| **P1** | **Mail Topology Realignment** | Topology & State | ✅ **Completed** | Re-homed Stalwart to the dedicated `smtp.` subdomain; migrated SnappyMail to `~/Sites/snappymail` with zero data loss. |
|
||||||
| **P2** | **GitOps Hardening** | Ingress Security | ✅ **Completed** | Authoritative Core repository registry (`deployments.yaml`), Compose AST security validator, systemd sandboxing. |
|
| **P2** | **GitOps Hardening** | Ingress Security | ✅ **Completed** | Authoritative Core repository registry (`deployments.yaml`), Compose AST security validator, systemd sandboxing. |
|
||||||
| **P3** | **Manifest Contract** | Domain Engine | ✅ **Completed** | Schema v1.0 with Pydantic v2 fail-closed models (`core_manifest.py`), two-axis status inspection, unified `appctl_engine.py`. |
|
| **P3** | **Manifest Contract** | Domain Engine | ✅ **Completed** | Schema v1.0 with Pydantic v2 fail-closed models (`core_manifest.py`), two-axis status inspection, unified `appctl_engine.py`. |
|
||||||
| **P4** | **Control Plane Daemon** | API & Dispatch | 🎯 **Current / Up Next** | `homelab-appctl.service` daemon, dual transports (socket + HTTP), thin-client CLI, append-only audit log. |
|
| **P4** | **Control Plane Daemon** | API & Dispatch | 🎯 **Current / Up Next** | `homelab-appctl.service` daemon, dual transports (socket + HTTP), mandatory auth admission gate, thin-client CLI, append-only audit log. |
|
||||||
| **P5** | **Identity & Secrets** | Auth & Providers | ⏳ **Planned** | ForwardAuth header parsing, user-scoped API tokens, `SecretProvider` reference resolution. |
|
| **P5** | **Identity & Secrets** | Auth & Providers | ⏳ **Planned** | LLDAP RBAC group mapping, Authelia ForwardAuth header integration, user-scoped token lifecycle, `SecretProvider` reference resolution. |
|
||||||
| **P6** | **Deployment Model & AI**| Intent Authoring | ⏳ **Planned** | Capability catalog, `DeploymentProposal` $\to$ `DeploymentModel` compiler, Git commit pipeline. |
|
| **P6** | **Deployment Model & AI**| Intent Authoring | ⏳ **Planned** | Capability catalog, `DeploymentProposal` $\to$ `DeploymentModel` compiler, Git commit pipeline. |
|
||||||
| **P7** | **Operations UI & Portal** | Client Integration | ⏳ **Planned** | Dedicated Operations UI client, Homepage read-only status integration widgets. |
|
| **P7** | **Operations UI & Portal** | Client Integration | ⏳ **Planned** | Dedicated Operations UI client, Homepage read-only status integration widgets. |
|
||||||
|
|
||||||
@@ -67,8 +67,8 @@ It describes the implementation trajectory and phased engineering milestones for
|
|||||||
1. *State Freeze & Verified Snapshot*: Generate timestamped, SHA256-verified backup archive of `Core/config/snappymail/data`.
|
1. *State Freeze & Verified Snapshot*: Generate timestamped, SHA256-verified backup archive of `Core/config/snappymail/data`.
|
||||||
2. *Workload Provisioning*: Scaffold `~/Sites/snappymail/` (Class B Image-Only workload) and provision persistent state root at `~/var/lib/homelab/snappymail/`.
|
2. *Workload Provisioning*: Scaffold `~/Sites/snappymail/` (Class B Image-Only workload) and provision persistent state root at `~/var/lib/homelab/snappymail/`.
|
||||||
3. *Zero-Data-Loss State Replication*: Copy data using `cp -a` and prove byte parity (`diff -r`).
|
3. *Zero-Data-Loss State Replication*: Copy data using `cp -a` and prove byte parity (`diff -r`).
|
||||||
4. *Stalwart Re-homing*: Update Stalwart public endpoint in `Core/docker-compose.yml` to `smtp.example.com`; remove SnappyMail from Core stack.
|
4. *Stalwart Re-homing*: Updated Stalwart public endpoint in `Core/docker-compose.yml` to the configured `smtp.<domain>` subdomain; removed SnappyMail from Core stack.
|
||||||
5. *Live Verification*: Verify webmail at `mail.example.com`, user logins, address books, IMAP/SMTP routing, and Diun SMTPS delivery on port 465.
|
5. *Live Verification*: Verified webmail at the configured `mail.<domain>` endpoint, user logins, address books, IMAP/SMTP routing, and Diun SMTPS delivery on port 465.
|
||||||
* **Exit Criteria**: 100% of user data survives cutover; mail flow and Diun alert delivery confirmed.
|
* **Exit Criteria**: 100% of user data survives cutover; mail flow and Diun alert delivery confirmed.
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -98,22 +98,23 @@ It describes the implementation trajectory and phased engineering milestones for
|
|||||||
|
|
||||||
### Milestone P4: Appctl Control Plane Daemon & Command-Oriented API
|
### Milestone P4: Appctl Control Plane Daemon & Command-Oriented API
|
||||||
**Status**: 🎯 **Current / Up Next**
|
**Status**: 🎯 **Current / Up Next**
|
||||||
* **Objective**: Evolve `appctl` from a collection of local shell scripts into the authoritative platform daemon.
|
* **Objective**: Evolve `appctl` from a collection of local shell scripts into the authoritative platform daemon while enforcing authorization gates from day one.
|
||||||
* **Key Deliverables**:
|
* **Key Deliverables**:
|
||||||
1. *Daemon Service (`homelab-appctl.service`)*: Systemd daemon exposing one logical API across dual transports: Unix domain socket (`/run/homelab/appctl.sock`) on host and HTTP listener for network clients.
|
1. *Daemon Service (`homelab-appctl.service`)*: Systemd daemon exposing one logical API across dual transports: Unix domain socket (`/run/homelab/appctl.sock`) on host and HTTP listener for network clients.
|
||||||
2. *Command-Oriented Operational Router*: Strongly-typed endpoints (`POST /operations/deploy`, `POST /operations/restart`, `POST /operations/pull`, `GET /workloads`, `GET /workloads/{id}/status`, `POST /operations/sync`).
|
2. *Mandatory Authorization Gate*: Establish the authentication/authorization middleware interface before exposing mutating routes; reject unauthenticated mutations across both Unix socket and HTTP transports.
|
||||||
3. *Thin-Client CLI*: Re-implement `scripts/appctl` as a lightweight dispatch client communicating with the local daemon socket.
|
3. *Command-Oriented Operational Router*: Strongly-typed endpoints (`POST /operations/deploy`, `POST /operations/restart`, `POST /operations/pull`, `GET /workloads`, `GET /workloads/{id}/status`, `POST /operations/sync`) invoking `core_manifest.py` and `appctl_engine.py` via internal interfaces.
|
||||||
4. *Append-Only Audit Log*: Record every mutating command to `~/.local/state/homelab/appctl/audit.jsonl` with restricted `0600` permissions. Telemetry captures `principal`, `action`, `target`, `transport`, `origin`, `client`, `timestamp`, and `result`.
|
4. *Thin-Client CLI*: Re-implement `scripts/appctl` as a lightweight dispatch client communicating with the local daemon socket.
|
||||||
* **Exit Criteria**: Hermetic API test suite passing; local socket and HTTP transport tests passing; audit log correctly capturing multi-dimensional telemetry.
|
5. *Append-Only Audit Log*: Record every mutating command to `~/.local/state/homelab/appctl/audit.jsonl` with restricted `0600` permissions. Telemetry captures `principal`, `action`, `target`, `transport`, `origin`, `client`, `timestamp`, and `result`.
|
||||||
|
* **Exit Criteria**: Hermetic API test suite passing; unauthenticated mutation attempts rejected across both transports; audit log capturing multi-dimensional telemetry.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Milestone P5: Identity, RBAC & SecretProvider Interface
|
### Milestone P5: Identity, RBAC & SecretProvider Interface
|
||||||
**Status**: ⏳ **Planned**
|
**Status**: ⏳ **Planned**
|
||||||
* **Objective**: Implement least-privilege identity boundaries and dynamic secret projection.
|
* **Objective**: Expand the P4 authorization gate with directory-backed RBAC identity providers and dynamic secret projection.
|
||||||
* **Key Deliverables**:
|
* **Key Deliverables**:
|
||||||
1. *Authentication Gateway*: Accept trusted identity headers from Traefik/Authelia (`Remote-User`, `Remote-Groups`) for web requests; validate explicit user-scoped API tokens for all CLI requests (local and remote); validate HMAC signatures for GitOps webhooks.
|
1. *Identity Provider Integration*: Plug Traefik/Authelia trusted headers (`Remote-User`, `Remote-Groups`) for web requests, LLDAP user-scoped API token lifecycle for CLI requests, and HMAC-SHA256 verification for GitOps webhooks into the P4 authorization middleware.
|
||||||
2. *Role-Based Authorization Engine*: Enforce group-based access control (`homelab-admin`, `homelab-operator`, `homelab-viewer`).
|
2. *Role-Based Authorization Engine*: Enforce LLDAP group-based access control (`homelab-admin`, `homelab-operator`, `homelab-viewer`).
|
||||||
3. *SecretProvider Interface*: Control plane resolves secret references (`secretKeyRef`) at container runtime, eliminating Git history pollution for workload credentials.
|
3. *SecretProvider Interface*: Control plane resolves secret references (`secretKeyRef`) at container runtime, eliminating Git history pollution for workload credentials.
|
||||||
* **Exit Criteria**: RBAC permission matrix verified by automated tests; secret references correctly materialized into runtime environments.
|
* **Exit Criteria**: RBAC permission matrix verified by automated tests; secret references correctly materialized into runtime environments.
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
description = "Homelab Core — Turnkey Declarative NixOS Appliance for roadtotech.me";
|
description = "Homelab Core — Turnkey Declarative NixOS Appliance";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst";
|
nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst";
|
||||||
@@ -14,6 +14,12 @@
|
|||||||
let
|
let
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
pythonEnv = pkgs.python3.withPackages (ps: with ps; [
|
||||||
|
pyyaml
|
||||||
|
types-pyyaml
|
||||||
|
pytest
|
||||||
|
pydantic
|
||||||
|
]);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
nixosConfigurations.server = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.server = nixpkgs.lib.nixosSystem {
|
||||||
@@ -27,17 +33,16 @@
|
|||||||
|
|
||||||
devShells.${system}.default = pkgs.mkShell {
|
devShells.${system}.default = pkgs.mkShell {
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
(python3.withPackages (ps: with ps; [
|
pythonEnv
|
||||||
pyyaml
|
|
||||||
types-pyyaml
|
|
||||||
pytest
|
|
||||||
pydantic
|
|
||||||
]))
|
|
||||||
pyright
|
pyright
|
||||||
ruff
|
ruff
|
||||||
];
|
];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
git config core.hooksPath .githooks 2>/dev/null || true
|
git config core.hooksPath .githooks 2>/dev/null || true
|
||||||
|
if [ -d .venv ] && [ ! -L .venv ]; then
|
||||||
|
rm -rf .venv
|
||||||
|
fi
|
||||||
|
ln -sfn ${pythonEnv} .venv
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -45,10 +50,7 @@
|
|||||||
test-suite = pkgs.runCommand "core-tests" {
|
test-suite = pkgs.runCommand "core-tests" {
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
git
|
git
|
||||||
python3
|
pythonEnv
|
||||||
python3Packages.pytest
|
|
||||||
python3Packages.pyyaml
|
|
||||||
python3Packages.pydantic
|
|
||||||
ruff
|
ruff
|
||||||
];
|
];
|
||||||
} ''
|
} ''
|
||||||
|
|||||||
+12
-3
@@ -8,14 +8,23 @@ echo "🔍 Running code linters (ruff)..."
|
|||||||
if command -v ruff &>/dev/null; then
|
if command -v ruff &>/dev/null; then
|
||||||
ruff check .
|
ruff check .
|
||||||
else
|
else
|
||||||
nix-shell -p ruff --run "ruff check ."
|
nix develop --command ruff check .
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "🔎 Running static type analysis (pyright)..."
|
||||||
|
if command -v pyright &>/dev/null; then
|
||||||
|
pyright
|
||||||
|
else
|
||||||
|
nix develop --command pyright
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "🧪 Running architecture & security test suite (pytest)..."
|
echo "🧪 Running architecture & security test suite (pytest)..."
|
||||||
if command -v pytest &>/dev/null; then
|
if [ -x ".venv/bin/pytest" ]; then
|
||||||
|
.venv/bin/pytest tests/
|
||||||
|
elif command -v pytest &>/dev/null; then
|
||||||
pytest tests/
|
pytest tests/
|
||||||
else
|
else
|
||||||
nix-shell -p python3Packages.pytest python3Packages.pyyaml python3Packages.pydantic --run "pytest tests/"
|
nix develop --command pytest tests/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "❄️ Verifying NixOS flake & sandbox checks..."
|
echo "❄️ Verifying NixOS flake & sandbox checks..."
|
||||||
|
|||||||
Reference in new issue
Block a user