feat: add scoop package management

This commit is contained in:
m1ngsama 2025-09-20 13:00:00 +08:00
parent 5ba3ea1f26
commit 2039170117
4 changed files with 424 additions and 0 deletions

213
scoop/README.md Normal file
View file

@ -0,0 +1,213 @@
# Scoop Package Management
Curated list of essential development tools and utilities for Windows, managed via [Scoop](https://scoop.sh).
## Prerequisites
Install Scoop if you haven't already:
```powershell
# Run in PowerShell (not PowerShell ISE)
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
irm get.scoop.sh | iex
```
## Quick Start
### Install All Packages
```powershell
cd scoop
.\install-packages.ps1
```
### Install Specific Category
```powershell
# Available categories: essentials, shells, terminal, editors, development, tools, databases, cloud, fonts, utilities
.\install-packages.ps1 -Category essentials
```
### Dry Run (Preview)
```powershell
.\install-packages.ps1 -DryRun
```
## Package Categories
### Essentials
Core utilities for Windows command line:
- **git** - Version control
- **7zip** - Archive manager
- **aria2** - Download manager (speeds up Scoop)
- **dark** - Terminal theme switcher
- **sudo** - Run commands as admin
- **grep, sed, less** - Unix-like text tools
- **curl, wget** - Download utilities
### Shells
- **pwsh** - PowerShell Core
- **oh-my-posh** - Prompt theme engine
### Terminal
- **windows-terminal** - Modern terminal emulator
- **wezterm** - GPU-accelerated terminal
### Editors
- **neovim** - Modern Vim-based editor
- **vscode** - Visual Studio Code
### Development
Programming languages and build tools:
- **nodejs-lts** - Node.js LTS
- **python** - Python
- **go** - Go programming language
- **rust** - Rust programming language
- **gcc, make, cmake** - C/C++ toolchain
### Tools
Modern CLI replacements and utilities:
- **fzf** - Fuzzy finder
- **ripgrep** - Fast grep alternative
- **fd** - Fast find alternative
- **bat** - Cat with syntax highlighting
- **eza** - Modern ls replacement
- **zoxide** - Smart cd command
- **delta** - Better git diff
- **lazygit** - Git TUI
- **gh** - GitHub CLI
### Databases
- **postgresql** - PostgreSQL database
- **redis** - Redis cache
- **mysql** - MySQL database
### Cloud
- **aws** - AWS CLI
- **azure-cli** - Azure CLI
- **terraform** - Infrastructure as code
### Fonts
Nerd Fonts with icon support:
- **CascadiaCode-NF** - Microsoft's Cascadia Code
- **FiraCode-NF** - Fira Code with ligatures
- **JetBrainsMono-NF** - JetBrains Mono
### Utilities
Windows productivity tools:
- **everything** - Fast file search
- **quicklook** - File preview (like macOS)
- **powertoys** - Microsoft PowerToys
- **ditto** - Clipboard manager
- **keypirinha** - Launcher (like Alfred)
## Export Current Setup
Save your currently installed packages:
```powershell
.\export-packages.ps1
```
This creates `installed-packages.json` with all your packages.
## Maintenance
### Update All Packages
```powershell
scoop update *
```
### Check Status
```powershell
scoop status
```
### Cleanup Old Versions
```powershell
scoop cleanup *
```
### Clear Cache
```powershell
scoop cache rm *
```
## Customization
Edit `packages.json` to customize the package list for your needs. Structure:
```json
{
"description": "...",
"buckets": ["list", "of", "buckets"],
"packages": {
"category": ["package1", "package2"]
}
}
```
## Useful Scoop Commands
```powershell
# Search for packages
scoop search <name>
# Show package info
scoop info <package>
# List installed packages
scoop list
# Uninstall package
scoop uninstall <package>
# Hold package version
scoop hold <package>
# Unhold package
scoop unhold <package>
```
## Buckets
Buckets are package repositories. Default buckets included:
- **extras** - Additional apps not in main bucket
- **nerd-fonts** - Patched fonts with icons
- **versions** - Multiple versions of packages
Add more buckets:
```powershell
scoop bucket add java
scoop bucket add games
```
## Tips
1. **Enable aria2** for faster downloads:
```powershell
scoop install aria2
scoop config aria2-enabled true
```
2. **Use sudo** for apps requiring admin:
```powershell
sudo scoop install <package>
```
3. **Check for updates regularly**:
```powershell
scoop status
scoop update *
```
4. **Keep things clean**:
```powershell
scoop cleanup *
scoop cache rm *
```

46
scoop/export-packages.ps1 Normal file
View file

@ -0,0 +1,46 @@
# Export Scoop Installed Packages
# Creates a backup of currently installed packages
$outputFile = Join-Path $PSScriptRoot "installed-packages.json"
function Write-ColorOutput {
param($message, $color = "White")
Write-Host $message -ForegroundColor $color
}
# Check if scoop is installed
if (-not (Get-Command scoop -ErrorAction SilentlyContinue)) {
Write-ColorOutput "Error: Scoop is not installed!" "Red"
exit 1
}
Write-ColorOutput "=== Exporting Scoop Packages ===" "Magenta"
Write-ColorOutput ""
# Get installed packages
$installed = scoop list | Select-Object -Skip 1 | ForEach-Object {
$line = $_.Trim()
if ($line -and $line -notmatch "^-+$") {
($line -split '\s+')[0]
}
}
# Get buckets
$buckets = scoop bucket list | Select-Object -Skip 1 | ForEach-Object {
($_.Trim() -split '\s+')[0]
}
# Create export object
$export = @{
timestamp = (Get-Date -Format "yyyy-MM-dd HH:mm:ss")
buckets = $buckets
packages = $installed
}
# Save to JSON
$export | ConvertTo-Json -Depth 10 | Set-Content $outputFile
Write-ColorOutput "✓ Exported $($installed.Count) packages to: $outputFile" "Green"
Write-ColorOutput ""
Write-ColorOutput "Buckets: $($buckets.Count)" "Cyan"
Write-ColorOutput "Packages: $($installed.Count)" "Cyan"

View file

@ -0,0 +1,89 @@
# Scoop Package Installation Script
# Installs essential development tools and utilities
param(
[string]$Category = "all",
[switch]$DryRun
)
$packagesFile = Join-Path $PSScriptRoot "packages.json"
$packages = Get-Content $packagesFile | ConvertFrom-Json
function Write-ColorOutput {
param($message, $color = "White")
Write-Host $message -ForegroundColor $color
}
function Install-Package {
param($packageName)
if ($DryRun) {
Write-ColorOutput " [DRY RUN] Would install: $packageName" "Yellow"
return
}
Write-ColorOutput " Installing: $packageName" "Cyan"
scoop install $packageName
if ($LASTEXITCODE -eq 0) {
Write-ColorOutput " ✓ Installed: $packageName" "Green"
} else {
Write-ColorOutput " ✗ Failed: $packageName" "Red"
}
}
function Add-Bucket {
param($bucketName)
if ($DryRun) {
Write-ColorOutput "[DRY RUN] Would add bucket: $bucketName" "Yellow"
return
}
Write-ColorOutput "Adding bucket: $bucketName" "Cyan"
scoop bucket add $bucketName
}
# Check if scoop is installed
if (-not (Get-Command scoop -ErrorAction SilentlyContinue)) {
Write-ColorOutput "Error: Scoop is not installed!" "Red"
Write-ColorOutput "Install Scoop first: https://scoop.sh" "Yellow"
exit 1
}
Write-ColorOutput "=== Scoop Package Installation ===" "Magenta"
Write-ColorOutput ""
# Add buckets
Write-ColorOutput "Adding buckets..." "Green"
foreach ($bucket in $packages.buckets) {
Add-Bucket $bucket
}
Write-ColorOutput ""
# Install packages based on category
if ($Category -eq "all") {
foreach ($cat in $packages.packages.PSObject.Properties) {
Write-ColorOutput "Installing $($cat.Name) packages..." "Green"
foreach ($package in $cat.Value) {
Install-Package $package
}
Write-ColorOutput ""
}
} else {
if ($packages.packages.PSObject.Properties.Name -contains $Category) {
Write-ColorOutput "Installing $Category packages..." "Green"
foreach ($package in $packages.packages.$Category) {
Install-Package $package
}
} else {
Write-ColorOutput "Error: Category '$Category' not found!" "Red"
Write-ColorOutput "Available categories: $($packages.packages.PSObject.Properties.Name -join ', ')" "Yellow"
exit 1
}
}
Write-ColorOutput ""
Write-ColorOutput "=== Installation Complete ===" "Magenta"
Write-ColorOutput ""
Write-ColorOutput "Run 'scoop status' to check for updates." "Cyan"

76
scoop/packages.json Normal file
View file

@ -0,0 +1,76 @@
{
"description": "Essential development tools and utilities for Windows",
"buckets": [
"extras",
"nerd-fonts",
"versions"
],
"packages": {
"essentials": [
"git",
"7zip",
"aria2",
"dark",
"sudo",
"grep",
"sed",
"less",
"curl",
"wget"
],
"shells": [
"pwsh",
"oh-my-posh"
],
"terminal": [
"windows-terminal",
"wezterm"
],
"editors": [
"neovim",
"vscode"
],
"development": [
"nodejs-lts",
"python",
"go",
"rust",
"gcc",
"make",
"cmake"
],
"tools": [
"fzf",
"ripgrep",
"fd",
"bat",
"eza",
"zoxide",
"delta",
"lazygit",
"gh"
],
"databases": [
"postgresql",
"redis",
"mysql"
],
"cloud": [
"aws",
"azure-cli",
"terraform"
],
"fonts": [
"CascadiaCode-NF",
"FiraCode-NF",
"JetBrainsMono-NF"
],
"utilities": [
"everything",
"quicklook",
"powertoys",
"ditto",
"keypirinha"
]
}
}