317 lines
10 KiB
Plaintext
Raw Permalink Normal View History

feat: Add complete Nushell full distribution system ## Major Features Added - **Complete distribution infrastructure**: Build, package, and distribute Nushell binary alongside plugins - **Zero-prerequisite installation**: Bootstrap installers work on fresh systems without Rust/Cargo/Nushell - **Cross-platform support**: Linux, macOS, Windows (x86_64, ARM64) - **Self-contained packages**: Everything needed for complete Nushell environment ## New Components ### Build System - `scripts/build_nushell.nu` - Build nushell with all workspace plugins - `scripts/collect_full_binaries.nu` - Collect nu binary + all plugins - `justfiles/full_distro.just` - 40+ new recipes for distribution workflows ### Bootstrap Installers (Zero Prerequisites) - `installers/bootstrap/install.sh` - Universal POSIX installer (900+ lines) - `installers/bootstrap/install.ps1` - Windows PowerShell installer (800+ lines) - Complete platform detection, PATH setup, plugin registration ### Distribution System - `scripts/create_distribution_packages.nu` - Multi-platform package creator - `scripts/install_full_nushell.nu` - Advanced nu-based installer - `scripts/verify_installation.nu` - Installation verification suite - `scripts/lib/common_lib.nu` - Shared utilities and logging ### Configuration Management - `scripts/templates/default_config.nu` - Complete nushell configuration (500+ lines) - `scripts/templates/default_env.nu` - Cross-platform environment setup - `etc/distribution_config.toml` - Central distribution settings - `scripts/templates/uninstall.sh` & `uninstall.ps1` - Clean removal ## Key Workflows ```bash just build-full # Build nushell + all plugins just pack-full-all # Create packages for all platforms just verify-full # Verify installation just release-full-cross # Complete cross-platform release ``` ## Installation Experience - One-liner: `curl -sSf https://your-url/install.sh | sh` - Multiple modes: user, system, portable installation - Automatic plugin registration with verification - Professional uninstall capability ## Benefits - ✅ Solves bootstrap problem - no prerequisites needed - ✅ Production-ready distribution system - ✅ Complete cross-platform support - ✅ Professional installation experience - ✅ Integrates seamlessly with existing plugin workflows - ✅ Enterprise-grade verification and logging
2025-09-24 18:52:07 +01:00
# Nushell Environment Configuration Template
# Default environment setup for Nushell + Plugins distribution
# Created by nushell-plugins full distribution system
# =============================================================================
# CORE ENVIRONMENT VARIABLES
# =============================================================================
# Default editor and browser
$env.EDITOR = (
if $nu.os-info.name == "windows" {
"notepad.exe"
} else if (which code | is-not-empty) {
"code"
} else if (which nano | is-not-empty) {
"nano"
} else if (which vim | is-not-empty) {
"vim"
} else {
"vi"
}
)
$env.BROWSER = (
if $nu.os-info.name == "windows" {
"msedge.exe"
} else if $nu.os-info.name == "macos" {
"open"
} else if (which firefox | is-not-empty) {
"firefox"
} else if (which chromium | is-not-empty) {
"chromium"
} else {
"xdg-open"
}
)
# Pager configuration
$env.PAGER = (
if (which bat | is-not-empty) {
"bat"
} else if (which less | is-not-empty) {
"less"
} else {
"more"
}
)
# =============================================================================
# NUSHELL SPECIFIC CONFIGURATION
# =============================================================================
# Nushell library directories
$env.NU_LIB_DIRS = [
($nu.config-path | path dirname | path join "scripts")
($nu.config-path | path dirname | path join "lib")
($nu.config-path | path dirname | path join "modules")
]
# Plugin directories
$env.NU_PLUGIN_DIRS = [
($nu.config-path | path dirname | path join "plugins")
]
# Custom prompt indicators
$env.PROMPT_INDICATOR = "〉"
$env.PROMPT_INDICATOR_VI_INSERT = ": "
$env.PROMPT_INDICATOR_VI_NORMAL = "〉"
$env.PROMPT_MULTILINE_INDICATOR = "::: "
# =============================================================================
# DEVELOPMENT ENVIRONMENT
# =============================================================================
# Rust environment
if (which cargo | is-not-empty) {
# Add cargo bin to PATH if not already there
let cargo_bin = ($env.HOME | path join ".cargo" "bin")
if ($cargo_bin | path exists) and ($env.PATH | split row (char esep) | where $it == $cargo_bin | is-empty) {
$env.PATH = ($env.PATH | split row (char esep) | append $cargo_bin | str join (char esep))
}
}
# Go environment
if (which go | is-not-empty) {
$env.GOPATH = ($env.HOME | path join "go")
let go_bin = ($env.GOPATH | path join "bin")
if ($go_bin | path exists) and ($env.PATH | split row (char esep) | where $it == $go_bin | is-empty) {
$env.PATH = ($env.PATH | split row (char esep) | append $go_bin | str join (char esep))
}
}
# Node.js environment
if (which npm | is-not-empty) {
# Add global npm bin to PATH
try {
let npm_bin = (npm config get prefix | str trim | path join "bin")
if ($npm_bin | path exists) and ($env.PATH | split row (char esep) | where $it == $npm_bin | is-empty) {
$env.PATH = ($env.PATH | split row (char esep) | append $npm_bin | str join (char esep))
}
}
}
# Python environment
if (which python3 | is-not-empty) or (which python | is-not-empty) {
# Add user Python bin to PATH
let python_cmd = if (which python3 | is-not-empty) { "python3" } else { "python" }
try {
let python_user_bin = (run-external $python_cmd "-m" "site" "--user-base" | str trim | path join "bin")
if ($python_user_bin | path exists) and ($env.PATH | split row (char esep) | where $it == $python_user_bin | is-empty) {
$env.PATH = ($env.PATH | split row (char esep) | append $python_user_bin | str join (char esep))
}
}
}
# =============================================================================
# SYSTEM SPECIFIC CONFIGURATION
# =============================================================================
# Linux specific
if $nu.os-info.name == "linux" {
# Add local bin directories to PATH
let local_bins = [
($env.HOME | path join ".local" "bin")
"/usr/local/bin"
]
for local_bin in $local_bins {
if ($local_bin | path exists) and ($env.PATH | split row (char esep) | where $it == $local_bin | is-empty) {
$env.PATH = ($env.PATH | split row (char esep) | append $local_bin | str join (char esep))
}
}
# XDG directories
$env.XDG_CONFIG_HOME = ($env.HOME | path join ".config")
$env.XDG_DATA_HOME = ($env.HOME | path join ".local" "share")
$env.XDG_CACHE_HOME = ($env.HOME | path join ".cache")
}
# macOS specific
if $nu.os-info.name == "macos" {
# Add Homebrew to PATH if it exists
let homebrew_paths = [
"/opt/homebrew/bin" # Apple Silicon
"/usr/local/bin" # Intel
]
for homebrew_path in $homebrew_paths {
if ($homebrew_path | path exists) and ($env.PATH | split row (char esep) | where $it == $homebrew_path | is-empty) {
$env.PATH = ($env.PATH | split row (char esep) | prepend $homebrew_path | str join (char esep))
}
}
# macOS specific environment variables
if (which brew | is-not-empty) {
$env.HOMEBREW_NO_ANALYTICS = "1"
$env.HOMEBREW_NO_AUTO_UPDATE = "1"
}
}
# Windows specific
if $nu.os-info.name == "windows" {
# Windows specific environment (most variables should already be set by system)
# Add user local bin if it exists
let local_bin = ($env.USERPROFILE | path join ".local" "bin")
if ($local_bin | path exists) and ($env.PATH | split row ";" | where $it == $local_bin | is-empty) {
$env.PATH = ($env.PATH + ";" + $local_bin)
}
}
# =============================================================================
# PERFORMANCE AND BEHAVIOR
# =============================================================================
# History configuration
$env.NU_HISTORY_SIZE = 10000
# Completions
$env.NU_COMPLETION_ALGORITHM = "prefix" # or "fuzzy"
# Plugin timeout (in seconds)
$env.NU_PLUGIN_TIMEOUT = 60
# =============================================================================
# CUSTOM ALIASES AND SHORTCUTS
# =============================================================================
# Common directory shortcuts
$env.REPOS = ($env.HOME | path join "repos")
$env.PROJECTS = ($env.HOME | path join "projects")
$env.DOWNLOADS = (
if $nu.os-info.name == "windows" {
($env.USERPROFILE | path join "Downloads")
} else {
($env.HOME | path join "Downloads")
}
)
# =============================================================================
# THEME AND APPEARANCE
# =============================================================================
# Terminal colors (if supported)
$env.COLORTERM = "truecolor"
# LS_COLORS for better directory listings
if $nu.os-info.name != "windows" {
$env.LS_COLORS = "di=1;34:ln=1;36:so=1;35:pi=1;33:ex=1;32:bd=1;33:cd=1;33:su=1;31:sg=1;31:tw=1;34:ow=1;34"
}
# =============================================================================
# CONDITIONAL FEATURES
# =============================================================================
# Enable starship prompt if available
if (which starship | is-not-empty) {
$env.STARSHIP_CONFIG = ($nu.config-path | path dirname | path join "starship.toml")
}
# Enable zoxide if available
if (which zoxide | is-not-empty) {
$env._ZO_DATA_DIR = ($nu.config-path | path dirname | path join "zoxide")
}
# Enable direnv if available
if (which direnv | is-not-empty) {
$env.DIRENV_LOG_FORMAT = "" # Quiet direnv output
}
# =============================================================================
# PLUGIN SPECIFIC CONFIGURATION
# =============================================================================
# Clipboard plugin settings
$env.NU_CLIPBOARD_PROVIDER = (
if $nu.os-info.name == "linux" and (which xclip | is-not-empty) {
"xclip"
} else if $nu.os-info.name == "linux" and (which wl-copy | is-not-empty) {
"wl-clipboard"
} else if $nu.os-info.name == "macos" {
"pbcopy"
} else if $nu.os-info.name == "windows" {
"windows"
} else {
"none"
}
)
# Image plugin settings
$env.NU_IMAGE_VIEWER = (
if $nu.os-info.name == "macos" {
"open"
} else if $nu.os-info.name == "windows" {
"mspaint"
} else if (which feh | is-not-empty) {
"feh"
} else if (which eog | is-not-empty) {
"eog"
} else {
"xdg-open"
}
)
# =============================================================================
# USER CUSTOMIZATION SECTION
# =============================================================================
# Load user-specific environment file if it exists
let user_env_file = ($nu.config-path | path dirname | path join "user_env.nu")
if ($user_env_file | path exists) {
source $user_env_file
}
# Load local environment file if it exists (for project-specific settings)
let local_env_file = (pwd | path join ".nu_env")
if ($local_env_file | path exists) {
source $local_env_file
}
# =============================================================================
# FINAL PATH CLEANUP
# =============================================================================
# Remove duplicate PATH entries while preserving order
$env.PATH = (
$env.PATH
| split row (char esep)
| uniq
| where ($it | path exists)
| str join (char esep)
)
# =============================================================================
# STARTUP INFORMATION (Optional)
# =============================================================================
# Uncomment to show environment info on startup
# print $"🚀 Nushell environment loaded"
# print $"📁 Config: ($nu.config-path)"
# print $"🧩 Plugins: (plugin list | length) loaded"
# print $"💻 Platform: ($nu.os-info.name) ($nu.os-info.arch)"
# =============================================================================
# NOTES FOR CUSTOMIZATION
# =============================================================================
# This file contains sensible defaults for a Nushell + Plugins environment.
# To customize:
#
# 1. Create user_env.nu in the same directory for user-specific settings
# 2. Create .nu_env in project directories for project-specific settings
# 3. Modify this file directly (but changes may be lost on updates)
#
# For more information:
# - Nushell Book: https://nushell.sh/book/
# - Environment Variables: https://nushell.sh/book/environment.html
# - Custom Commands: https://nushell.sh/book/custom_commands.html