feat(shells): add opencode dev shell with mkOpencodeRules demo
Some checks failed
Update Nix Packages with nix-update / nix-update (push) Failing after 2m27s
Some checks failed
Update Nix Packages with nix-update / nix-update (push) Failing after 2m27s
This commit is contained in:
@@ -78,11 +78,11 @@
|
||||
|
||||
# Development shells for various programming environments
|
||||
# Usage: nix develop .#<shell-name>
|
||||
# Available shells: default, python, devops
|
||||
# Available shells: default, python, devops, opencode
|
||||
devShells = forAllSystems (system: let
|
||||
pkgs = pkgsFor system;
|
||||
in
|
||||
import ./shells {inherit pkgs;});
|
||||
import ./shells {inherit pkgs inputs;});
|
||||
|
||||
# Formatter for 'nix fmt'
|
||||
formatter = forAllSystems (system: (pkgsFor system).alejandra);
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
# Development shells for various programming environments
|
||||
# Each shell can be accessed via: nix develop .#<shell-name>
|
||||
# Or used in home-manager/system configs
|
||||
{pkgs}: {
|
||||
{
|
||||
pkgs,
|
||||
inputs,
|
||||
}: {
|
||||
# Default shell for working on this repository
|
||||
default = pkgs.mkShell {
|
||||
name = "m3ta-nixpkgs-dev";
|
||||
@@ -27,6 +30,7 @@
|
||||
};
|
||||
|
||||
# Import all individual shell environments
|
||||
python = import ./python.nix {inherit pkgs;};
|
||||
devops = import ./devops.nix {inherit pkgs;};
|
||||
python = import ./python.nix {inherit pkgs inputs;};
|
||||
devops = import ./devops.nix {inherit pkgs inputs;};
|
||||
opencode = import ./opencode.nix {inherit pkgs inputs;};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
# DevOps development environment
|
||||
# Usage: nix develop .#devops
|
||||
{pkgs}:
|
||||
{
|
||||
pkgs,
|
||||
inputs ? null,
|
||||
}:
|
||||
pkgs.mkShell {
|
||||
name = "devops-dev";
|
||||
|
||||
|
||||
155
shells/opencode.nix
Normal file
155
shells/opencode.nix
Normal file
@@ -0,0 +1,155 @@
|
||||
# OpenCode development environment with AI coding rules
|
||||
# This shell demonstrates the mkOpencodeRules library provided by this repository
|
||||
# Usage: nix develop .#opencode
|
||||
#
|
||||
# To enable OpenCode 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 opencode-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
|
||||
# This demonstrates how to use mkOpencodeRules in a real project
|
||||
rulesConfig = lib.optionalAttrs (agents != null) {
|
||||
rules = m3taLib.opencode-rules.mkOpencodeRules {
|
||||
# Pass the AGENTS repository path
|
||||
inherit agents;
|
||||
|
||||
# Languages relevant to this repository
|
||||
languages = ["python" "typescript" "nix"];
|
||||
|
||||
# Frameworks used in this repo
|
||||
frameworks = ["n8n"];
|
||||
|
||||
# Standard concerns for development
|
||||
concerns = [
|
||||
"coding-style"
|
||||
"naming"
|
||||
"documentation"
|
||||
"testing"
|
||||
"git-workflow"
|
||||
"project-structure"
|
||||
];
|
||||
};
|
||||
};
|
||||
in
|
||||
pkgs.mkShell {
|
||||
name = "opencode-dev";
|
||||
|
||||
# Development tools
|
||||
buildInputs = with pkgs;
|
||||
[
|
||||
# OpenCode AI coding agent (if inputs are available)
|
||||
]
|
||||
++ lib.optionals (inputs != null)
|
||||
[inputs.opencode.packages.${pkgs.system}.opencode]
|
||||
++ [
|
||||
# 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
|
||||
];
|
||||
|
||||
# Shell hook that sets up OpenCode rules
|
||||
shellHook = ''
|
||||
echo "🤖 OpenCode Development Environment"
|
||||
echo ""
|
||||
echo "This environment demonstrates the mkOpencodeRules library"
|
||||
echo "provided by the m3ta-nixpkgs repository."
|
||||
echo ""
|
||||
|
||||
${
|
||||
if (agents != null)
|
||||
then ''
|
||||
# Execute the OpenCode rules shellHook
|
||||
${rulesConfig.rules.shellHook}
|
||||
|
||||
echo "✅ OpenCode rules configured!"
|
||||
''
|
||||
else ''
|
||||
echo "⚠️ OpenCode rules not configured"
|
||||
echo ""
|
||||
echo "To enable OpenCode rules, add the agents input to your flake.nix:"
|
||||
echo ""
|
||||
echo " inputs = {"
|
||||
echo " m3ta-nixpkgs.url = \"git+https://code.m3ta.dev/m3tam3re/nixpkgs\";"
|
||||
echo " agents = {"
|
||||
echo " url = \"git+https://code.m3ta.dev/m3tam3re/AGENTS\";"
|
||||
echo " flake = false;"
|
||||
echo " };"
|
||||
echo " };"
|
||||
echo ""
|
||||
echo "Then pass agents to the shell:"
|
||||
echo " opencode = import ./opencode.nix { inherit pkgs inputs agents; };"
|
||||
''
|
||||
}
|
||||
|
||||
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 ""
|
||||
${
|
||||
if (agents == null)
|
||||
then ''
|
||||
echo "💡 Using mkOpencodeRules in your project:"
|
||||
echo ""
|
||||
echo "Add to your flake.nix:"
|
||||
echo " inputs = {"
|
||||
echo " m3ta-nixpkgs.url = \"git+https://code.m3ta.dev/m3tam3re/nixpkgs\";"
|
||||
echo " agents = {"
|
||||
echo " url = \"git+https://code.m3ta.dev/m3tam3re/AGENTS\";"
|
||||
echo " flake = false;"
|
||||
echo " };"
|
||||
echo " };"
|
||||
echo ""
|
||||
echo " outputs = {self, nixpkgs, m3ta-nixpkgs, agents, ...}:"
|
||||
echo " let"
|
||||
echo " system = \"x86_64-linux\";"
|
||||
echo " pkgs = nixpkgs.legacyPackages.''${system};"
|
||||
echo " m3taLib = m3ta-nixpkgs.lib.''${system};"
|
||||
echo " rules = m3taLib.opencode-rules.mkOpencodeRules {"
|
||||
echo " inherit agents;"
|
||||
echo " languages = [\"python\" \"typescript\"];"
|
||||
echo " frameworks = [\"n8n\"];"
|
||||
echo " };"
|
||||
echo " in {"
|
||||
echo " devShells.''${system}.default = pkgs.mkShell {"
|
||||
echo " shellHook = rules.shellHook;"
|
||||
echo " };"
|
||||
echo " };"
|
||||
''
|
||||
else ""
|
||||
}
|
||||
echo ""
|
||||
'';
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
# Modern Python development environment with marimo and uv — Nushell version
|
||||
# Usage: nix develop .#python (drops into Nushell)
|
||||
{pkgs}: let
|
||||
{
|
||||
pkgs,
|
||||
inputs ? null,
|
||||
}: let
|
||||
# Use the latest Python available in nixpkgs
|
||||
python = pkgs.python313;
|
||||
in
|
||||
|
||||
Reference in New Issue
Block a user