feat(ci): expand flake checks with luacheck, add test runner script, and streamline nix CLI ergonomics

- Add `luacheck` check block to `checks.${system}` in `flake.nix` for Neovim Lua scripts.
- Add visual status indicators and completion logs across all flake check derivations.
- Create local test runner script (`scripts/test`) to execute ShellCheck, Lua linting, Ruff, Pyright, and flake checks locally.
- Add intelligent Bash wrapper in `home/shell/interactive.sh` to auto-inject `-L` into `nix flake check`.
- Add `check` and `nfc` shell aliases in `home/shell.nix`.
- Clean up whitespace in `home/config/nvim/lsp.lua`.

Rationale: Enhances local developer experience and code quality gates by standardizing linting, type-checking, and test execution workflows.
This commit is contained in:
kiskaadee committed 2026-09-14 19:25:16 -05:00
1 parent fbb36aceef
commit ff5394c7b2
4 files changed
+60 -8

No files matched your search

+26 -8
View File
@@ -65,11 +65,33 @@
# --- Linting, Formatting & Static Analysis Checks ---
# Executed via `nix flake check` or `nix build .#checks.<system>.<check>`
checks.${system} = {
# Shell script linting via ShellCheck
shellcheck = pkgs.runCommand "check-shellcheck" {
nativeBuildInputs = [ pkgs.shellcheck ];
} ''
echo "🐚 [ShellCheck] Checking shell scripts..."
find ${self} -type f -name "*.sh" -exec shellcheck -s bash {} +
echo "✅ [ShellCheck] All shell scripts passed!"
touch $out
'';
# Lua linting via luacheck
luacheck = pkgs.runCommand "check-luacheck" {
nativeBuildInputs = [ pkgs.luaPackages.luacheck ];
} ''
echo "🌙 [Lua] Checking Neovim Lua configuration..."
luacheck ${self}/home/config/nvim --globals vim
echo "✅ [Lua] All Lua files passed!"
touch $out
'';
# Python linting via ruff
ruff-lint = pkgs.runCommand "check-ruff-lint" {
nativeBuildInputs = [ pkgs.ruff ];
} ''
echo "🐍 [Ruff] Running Python linter (ruff check)..."
ruff check --no-cache ${self}
echo "✅ [Ruff] All Python files passed linting!"
touch $out
'';
@@ -77,7 +99,9 @@
ruff-format = pkgs.runCommand "check-ruff-format" {
nativeBuildInputs = [ pkgs.ruff ];
} ''
echo "🎨 [Ruff] Checking Python formatting (ruff format)..."
ruff format --check ${self}
echo "✅ [Ruff] All Python files properly formatted!"
touch $out
'';
@@ -85,15 +109,9 @@
pyright = pkgs.runCommand "check-pyright" {
nativeBuildInputs = [ pkgs.pyright ];
} ''
echo "🔬 [Pyright] Running Python type analysis..."
pyright ${self}
touch $out
'';
# Shell script linting via ShellCheck
shellcheck = pkgs.runCommand "check-shellcheck" {
nativeBuildInputs = [ pkgs.shellcheck ];
} ''
find ${self} -type f -name "*.sh" -exec shellcheck -s bash {} +
echo "✅ [Pyright] All Python type checks passed!"
touch $out
'';
};
+2
View File
@@ -193,6 +193,8 @@ in
zed = "zeditor";
reload = "exec bash";
ts = "tmux-sessionizer";
check = "~/Config/scripts/test";
nfc = "nix flake check -L";
ff = "fastfetch --logo none";
# System Navigation
+10
View File
@@ -17,3 +17,13 @@ fi
if [[ $- == *i* ]]; then
fastfetch --logo none
fi
# --- Nix Command Ergonomics ---
# Ensure `nix flake check` always prints build and verification logs (-L)
nix() {
if [[ "${1:-}" == "flake" && "${2:-}" == "check" && "$*" != *"--log-format"* && "$*" != *"-L"* ]]; then
command nix flake check -L "${@:3}"
else
command nix "$@"
fi
}
Executable
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# scripts/test - Automated test & invariant verification runner for Workstation Config
set -euo pipefail
cd "$(dirname "$0")/.."
echo "🐚 Running ShellCheck across shell scripts..."
find . -type f -name "*.sh" -not -path "./.git/*" -exec shellcheck -s bash {} +
echo "✅ ShellCheck passed!"
echo "🌙 Checking Neovim Lua configuration (luacheck)..."
nix-shell -p luaPackages.luacheck --run "luacheck home/config/nvim --globals vim"
echo "✅ Lua checks passed!"
echo "🐍 Running Python linters & type analysis (Ruff & Pyright)..."
nix-shell -p ruff pyright --run "ruff check --no-cache . && ruff format --check . && pyright ."
echo "✅ Python checks passed!"
echo "❄️ Verifying NixOS flake & sandbox checks..."
nix flake check -L
echo "✨ All checks and static analyses passed successfully!"