- Reorganized emacs configuration with profiles in modules/development/emacs.nix - Updated machine configurations to use new emacs module structure - Cleaned up lab-tool project by removing archive, research, testing, and utils directories - Streamlined lab-tool to focus on core deployment functionality with deploy-rs - Added DEVELOPMENT.md documentation for lab-tool 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
3.4 KiB
3.4 KiB
Lab Tool Development Guide
Build Commands
Build the Lab Tool Package
# Build the lab tool from project root
nix build .#packages.x86_64-linux.lab
# The binary will be available at ./result/bin/lab
Quick Development Build
# From the lab-tool directory
cd packages/lab-tool
nix build .#lab-tool # if available, otherwise use full path above
Testing Commands
Test Lab Tool Functionality
# Test help command
./result/bin/lab help
# Test machine listing
./result/bin/lab machines
# Test status check
./result/bin/lab status
# Test dry-run deployment
./result/bin/lab deploy little-rascal --dry-run
# Test actual deployment
./result/bin/lab deploy little-rascal
Test System Integration
# Deploy configuration using nixos-rebuild (requires sudo access)
sudo nixos-rebuild switch --flake .#little-rascal --show-trace
# Or using lab tool (recommended)
lab deploy little-rascal
Development Workflow
1. Make Changes
Edit source files in:
main.scm
- CLI interfacelab/deployment.scm
- Deployment logiclab/machines.scm
- Machine managementutils/*.scm
- Utility functions
2. Build and Test
# Rebuild after changes
nix build .#packages.x86_64-linux.lab
# Test basic functionality
./result/bin/lab help
./result/bin/lab machines
# Test deployment (dry-run first)
./result/bin/lab deploy little-rascal --dry-run
3. Debug Issues
# Enable Guile debugging
export GUILE_AUTO_COMPILE=0
# Run with verbose output
./result/bin/lab deploy little-rascal --dry-run
# Check deploy-rs command directly
deploy --help
Common Development Tasks
Update Deploy-rs Command Format
Edit lab/deployment.scm
in the build-deploy-command
function:
;; Example: Add new flags
(when new-option
(set! flags (cons "--new-flag=value" flags)))
Add New Machine
Add to the machine list in lab/machines.scm
or config files.
Debug Deployment Issues
- Check the generated command with dry-run
- Test deploy-rs directly:
deploy '.#little-rascal' --dry-activate
- Check flake structure:
nix flake show
Module Structure
main.scm
- Entry point and CLI parsinglab/core.scm
- Core lab functionalitylab/deployment.scm
- Deploy-rs integrationlab/machines.scm
- Machine managementlab/monitoring.scm
- Health checks and monitoringlab/auto-update.scm
- Automatic update systemutils/logging.scm
- Logging system with colorsutils/config.scm
- Configuration managementutils/ssh.scm
- SSH utilitiesutils/json.scm
- JSON handling
Troubleshooting
Build Failures
# Check flake structure
nix flake show
# Verify Guile syntax
guile --no-auto-compile -c "(load \"main.scm\")"
Runtime Errors
# Check module exports
guile -c "(use-modules (lab deployment)) (display 'loaded)"
# Test individual functions
guile -c "(use-modules (lab deployment)) (deploy-machine \"little-rascal\" \"default\" '((dry-run . #t)))"
Deploy-rs Issues
# Test deploy-rs directly
deploy '.#little-rascal' --dry-activate
# Check machine connectivity
ssh sma@little-rascal 'echo "connected"'
Best Practices
- Always test with dry-run first
- Use the lab tool instead of direct nixos-rebuild when possible
- Check flake status before deployment (
nix flake check
) - Keep commits atomic - one feature/fix per commit
- Update this file when adding new commands or workflows