+devshell structure

This commit is contained in:
m3tam3re
2025-10-12 16:21:40 +02:00
parent 27d92a238b
commit 11755d832f
5 changed files with 375 additions and 19 deletions

36
shells/default.nix Normal file
View File

@@ -0,0 +1,36 @@
# Development shells for various programming environments
# Each shell can be accessed via: nix develop .#<shell-name>
# Or used in home-manager/system configs
{pkgs}: {
# Default shell for working on this repository
default = pkgs.mkShell {
name = "m3ta-nixpkgs-dev";
buildInputs = with pkgs; [
nil # Nix LSP
nixpkgs-fmt # Nix formatter
nix-tree # Explore dependency trees
statix # Nix linter
deadnix # Find dead Nix code
];
shellHook = ''
echo "🚀 m3ta-nixpkgs development environment"
echo "Available commands:"
echo " nix flake check - Check flake validity"
echo " nix flake show - Show flake outputs"
echo " nix build .#<pkg> - Build a package"
echo " nixpkgs-fmt . - Format Nix files"
echo " statix check . - Lint Nix files"
echo " deadnix . - Find dead code"
'';
};
# Import all individual shell environments
rust = import ./rust.nix {inherit pkgs;};
python = import ./python.nix {inherit pkgs;};
nodejs = import ./nodejs.nix {inherit pkgs;};
go = import ./go.nix {inherit pkgs;};
web = import ./web.nix {inherit pkgs;};
devops = import ./devops.nix {inherit pkgs;};
}

144
shells/devops.nix Normal file
View File

@@ -0,0 +1,144 @@
# DevOps development environment
# Usage: nix develop .#devops
{pkgs}:
pkgs.mkShell {
name = "devops-dev";
buildInputs = with pkgs; [
# Container tools
docker
docker-compose
podman
buildah
skopeo
dive # Docker image explorer
# Kubernetes tools
kubectl
kubectx # Includes kubens
k9s # TUI for Kubernetes
kubernetes-helm
helmfile
kustomize
stern # Multi-pod log tailing
kubeseal # Sealed secrets
# Infrastructure as Code
terraform
opentofu # Open-source Terraform fork
terragrunt
terraform-docs
tflint
infracost # Cost estimates for Terraform
# Configuration management
ansible
ansible-lint
# CI/CD tools
github-cli
gitlab-runner
act # Run GitHub Actions locally
# Cloud CLIs
awscli2
google-cloud-sdk
azure-cli
doctl # DigitalOcean CLI
# Monitoring and observability
prometheus
grafana
# Note: promtool is included in prometheus package
# Service mesh
istioctl
linkerd
# Security and secrets
vault
sops
age # Encryption tool
trivy # Security scanner
# Scripting and automation
python3
jq
yq-go
jo # JSON output from shell
# Network tools
curl
wget
httpie
netcat
nmap
tcpdump
wireshark-cli
# System utilities
htop
btop
lsof
tmux
git
gnumake
# Linters and formatters
shellcheck
shfmt
yamllint
];
# Environment variables
DOCKER_BUILDKIT = "1";
COMPOSE_DOCKER_CLI_BUILD = "1";
shellHook = ''
echo "🚀 DevOps Development Environment"
echo ""
echo "Container tools:"
echo " docker / podman - Container runtime"
echo " docker-compose - Multi-container applications"
echo " dive - Explore Docker images"
echo " buildah / skopeo - Build and manage containers"
echo ""
echo "Kubernetes:"
echo " kubectl - Kubernetes CLI"
echo " k9s - Kubernetes TUI"
echo " helm - Package manager"
echo " kubectx / kubens - Switch contexts/namespaces (kubens included in kubectx)"
echo " stern <pod> - Multi-pod logs"
echo ""
echo "Infrastructure as Code:"
echo " terraform / opentofu - Infrastructure provisioning"
echo " terragrunt - Terraform wrapper"
echo " ansible - Configuration management"
echo " tflint - Terraform linter"
echo ""
echo "Cloud CLIs:"
echo " aws - AWS CLI"
echo " gcloud - Google Cloud CLI"
echo " az - Azure CLI"
echo " doctl - DigitalOcean CLI"
echo ""
echo "Security & Secrets:"
echo " vault - HashiCorp Vault"
echo " sops - Secrets management"
echo " trivy - Security scanner"
echo " kubeseal - Sealed secrets"
echo ""
echo "CI/CD:"
echo " gh - GitHub CLI"
echo " act - Run GitHub Actions locally"
echo " gitlab-runner - GitLab CI runner"
echo ""
echo "Utilities:"
echo " jq / yq - JSON/YAML processors"
echo " httpie / curl - HTTP clients"
echo " shellcheck - Shell script linter"
echo ""
echo "💡 Tip: Use 'kubectx' and 'kubens' to quickly switch contexts"
echo ""
'';
}

78
shells/python.nix Normal file
View File

@@ -0,0 +1,78 @@
# Modern Python development environment with marimo and uv — Nushell version
# Usage: nix develop .#python (drops into Nushell)
{pkgs}: let
# Use the latest Python available in nixpkgs
python = pkgs.python314;
in
pkgs.mkShell {
name = "python-marimo-dev";
buildInputs = with pkgs; [
# Python interpreter
python
# Modern package manager
uv
# Essential system dependencies for numpy and scientific packages
stdenv.cc.cc.lib
zlib
gfortran
openblas
lapack
# Nushell itself
nushell
];
# Environment variables for proper library linking
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath [
pkgs.stdenv.cc.cc.lib
pkgs.zlib
pkgs.gfortran.cc.lib
]}";
# Bash shellHook that sets up the environment and launches Nushell
shellHook = ''
echo "🐍 Python + Marimo Development Environment"
echo ""
echo "Python version: $(python --version)"
echo "uv version: $(uv --version)"
echo ""
# Create venv if it doesn't exist
if [ ! -d ".venv" ]; then
echo "Creating virtual environment..."
uv venv
fi
# Activate the virtual environment
source .venv/bin/activate
# Install marimo if not present
if ! python -c "import marimo" 2>/dev/null; then
echo "Installing marimo..."
uv pip install marimo
fi
# Install numpy if not present
if ! python -c "import numpy" 2>/dev/null; then
echo "Installing numpy..."
uv pip install numpy
fi
echo ""
echo " Environment ready!"
echo ""
echo "Quick start:"
echo " marimo edit - Start marimo notebook"
echo " uv pip install <package> - Install packages"
echo " python script.py - Run Python scripts"
echo ""
echo "💡 Popular packages: uv pip install pandas matplotlib scipy scikit-learn"
echo ""
# Launch Nushell
exec nu
'';
}