Some checks failed
Update Nix Packages with nix-update / nix-update (push) Failing after 3h23m59s
111 lines
3.0 KiB
Nix
111 lines
3.0 KiB
Nix
# AI coding agent development environment with coding rules
|
||
# Sets up coding rules for OpenCode and Pi, plus useful companion tools.
|
||
# Usage: nix develop .#coding
|
||
#
|
||
# To enable coding rules, add the agents input to your flake:
|
||
# agents = {
|
||
# url = "git+https://code.m3ta.dev/m3tam3re/AGENTS";
|
||
# flake = false;
|
||
# };
|
||
{
|
||
pkgs,
|
||
lib ? pkgs.lib,
|
||
inputs ? null,
|
||
agents ? null,
|
||
}: let
|
||
# Import the coding-rules library
|
||
m3taLib = import ../lib {lib = pkgs.lib;};
|
||
|
||
# Import custom packages
|
||
customPackages = import ../pkgs {inherit pkgs inputs;};
|
||
|
||
# Create rules configuration only if agents input is provided
|
||
rulesConfig = lib.optionalAttrs (agents != null) {
|
||
rules = m3taLib.coding-rules.mkCodingRules {
|
||
inherit agents;
|
||
|
||
# Languages relevant to this repository
|
||
languages = ["nix" "python" "shell"];
|
||
|
||
# Frameworks used in this repo
|
||
frameworks = ["n8n"];
|
||
|
||
# Standard concerns for development
|
||
concerns = [
|
||
"coding-style"
|
||
"naming"
|
||
"documentation"
|
||
"testing"
|
||
"git-workflow"
|
||
"project-structure"
|
||
];
|
||
|
||
# Also append rules to AGENTS.md for Pi agent discovery
|
||
forPi = true;
|
||
};
|
||
};
|
||
in
|
||
pkgs.mkShell {
|
||
name = "coding";
|
||
|
||
# Development tools
|
||
buildInputs = with pkgs; [
|
||
# Task management for AI coding sessions
|
||
customPackages.td
|
||
|
||
# Companion tool for CLI agents (diffs, file trees, task management)
|
||
customPackages.sidecar
|
||
|
||
# Code analysis tools
|
||
customPackages.code2prompt
|
||
|
||
# Nix development tools (for this repo)
|
||
nil
|
||
alejandra
|
||
statix
|
||
deadnix
|
||
];
|
||
|
||
shellHook = ''
|
||
echo "🤖 AI Coding Environment"
|
||
echo ""
|
||
|
||
${
|
||
if (agents != null)
|
||
then ''
|
||
# Set up coding rules for OpenCode + Pi
|
||
${rulesConfig.rules.shellHook}
|
||
|
||
echo "✅ Coding rules configured (OpenCode + Pi)"
|
||
echo " Languages: nix, python, shell"
|
||
echo " Frameworks: n8n"
|
||
echo " Concerns: coding-style, naming, documentation, testing, git-workflow, project-structure"
|
||
''
|
||
else ''
|
||
echo "⚠️ Coding rules not configured"
|
||
echo ""
|
||
echo "To enable, add the agents input to your flake.nix:"
|
||
echo ""
|
||
echo " agents = {"
|
||
echo " url = \"git+https://code.m3ta.dev/m3tam3re/AGENTS\";"
|
||
echo " flake = false;"
|
||
echo " };"
|
||
''
|
||
}
|
||
|
||
echo ""
|
||
echo "Available tools:"
|
||
echo " opencode - AI coding agent"
|
||
echo " td usage --new-session - View current tasks"
|
||
echo " sidecar - Companion tool (diffs, file trees, tasks)"
|
||
echo " code2prompt - Convert code to prompts"
|
||
echo ""
|
||
echo "Nix development tools:"
|
||
echo " nix flake check - Check flake validity"
|
||
echo " nix fmt . - Format Nix files"
|
||
echo " statix check . - Lint Nix files"
|
||
echo " deadnix . - Find dead code"
|
||
echo ""
|
||
'';
|
||
}
|