Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Development Tools

This category covers programming language runtimes, version control, build tools, editors, and debugging utilities.

Programming Language Runtimes

Clang

Clang is a C language family frontend for the LLVM compiler.

安装

environment.systemPackages = [ pkgs.clang ];

已验证的使用情况

# Generate LLVM IR instead of native code
clang -S -emit-llvm hello.c -o hello.ll

# Show included headers
clang -H -c hello.c -o /dev/null

# Compile with optimization
clang -O2 hello.c -o hello

GCC

GCC is the GNU Compiler Collection.

安装

environment.systemPackages = [ pkgs.gcc ];

已验证的使用情况

# Create object file only
gcc -c source.c

# Compile with output name
gcc -o program source.c

# Compile with debug information
gcc -g source.c -o program

# Link object files
gcc file1.o file2.o -o program

Go

Go is an open source programming language designed for simplicity and reliability.

安装

environment.systemPackages = [ pkgs.go ];

已验证的使用情况

# Initialize new Go module
go mod init module-name

# Build Go program
go build main.go

# Run Go program
go run main.go

# Format source
go fmt main.go

# Clean build artifacts
go clean

Lua

Lua is a powerful, efficient, lightweight, embeddable scripting language.

安装

environment.systemPackages = [ pkgs.lua ];

已验证的使用情况

# Execute Lua script
lua script.lua

# Run Lua code directly
lua -e "print('Hello World')"

Node.js

Node.js is a JavaScript runtime built on Chrome’s V8 engine.

安装

environment.systemPackages = [ pkgs.nodejs ];

已验证的使用情况

# Run Node.js script
node script.js

# Run Node.js code directly
node -e "console.log('Hello World')"

Octave

GNU Octave is a high-level language for numerical computations.

安装

environment.systemPackages = [ pkgs.octave ];

已验证的使用情况

# Execute Octave script
octave script.m

# Run Octave code directly
octave --eval "disp('Hello World')"

# Matrix operations
octave --eval "[1 2; 3 4] * [5; 6]"

# Statistical calculations
octave --eval "mean([1 2 3 4 5])"

OpenJDK

OpenJDK is a free and open-source implementation of the Java Platform.

安装

environment.systemPackages = [ pkgs.openjdk ];

已验证的使用情况

# Compile Java source file
javac HelloWorld.java

# Run Java program
java HelloWorld

Perl

Perl is a highly capable, feature-rich programming language.

安装

environment.systemPackages = [ pkgs.perl ];

已验证的使用情况

# Execute Perl script
perl script.pl

# Run Perl code directly
perl -e 'print "Hello World"'

PHP

PHP is a popular general-purpose scripting language for web development.

安装

environment.systemPackages = [ pkgs.php ];

已验证的使用情况

# Execute PHP script
php script.php

# Run PHP code directly
php -r "echo 'Hello World';"

Python3

Python is a high-level programming language.

安装

environment.systemPackages = [ pkgs.python3 ];

已验证的使用情况

# Execute Python script
python3 script.py

# Run Python code directly
python3 -c "print('Hello World')"

Ruby

Ruby is a dynamic, open source programming language.

安装

environment.systemPackages = [ pkgs.ruby ];

已验证的使用情况

# Execute Ruby script
ruby script.rb

# Run Ruby code directly
ruby -e "puts 'Hello World'"

Rust

Rust is a language empowering everyone to build reliable and efficient software.

安装

environment.systemPackages = [ pkgs.rustc ];

已验证的使用情况

# Compile Rust source code
rustc hello_world.rs

Version Control

Git

Git is a distributed version control system.

安装

environment.systemPackages = [ pkgs.git ];

已验证的使用情况

# Clone existing repository
git clone https://github.com/user/repo.git

# Check repository status
git status

# View commit history
git log

# Create and switch to new branch
git checkout -b new-feature

# View differences
git diff

# Add files to staging area
git add file.txt

# Commit changes
git commit -m "Commit message"

# Push changes to remote
git push origin main

Build Tools

Cargo

Cargo is the Rust package manager and build system.

安装

environment.systemPackages = [ pkgs.cargo ];

已验证的使用情况

# Create new Rust project
cargo new my_project

# Fast compilation check
cargo check

# Build project
cargo build

# Run project
cargo run

# Test project
cargo test

CMake

CMake is a cross-platform build system generator.

安装

environment.systemPackages = [ pkgs.cmake ];

已验证的使用情况

# Generate build files
cmake .

# Build project
cmake --build .

# Clean build
cmake --build . --target clean

Make

Make automates build processes.

安装

environment.systemPackages = [ pkgs.gnumake ];

已验证的使用情况

# Run make with specific target
make target_name

# Run make with specific Makefile
make -f Makefile.custom

Meson

Meson is a fast and user-friendly build system.

安装

environment.systemPackages = with pkgs; [
    (python3.withPackages (p: [ p.meson ]))
    meson
    ninja
];

已验证的使用情况

# Initialize project
meson setup builddir

# Build project
meson compile -C builddir

# Run output from build directory
./builddir/hello

Ninja

Ninja is a small, fast build system focused on speed.

安装

environment.systemPackages = [ pkgs.ninja ];

已验证的使用情况

# Build in an existing build directory
ninja -C build

# List available targets
ninja -C build -t targets

Editors & IDEs

Emacs

GNU Emacs is a customizable, extensible text editor.

安装

environment.systemPackages = [ pkgs.emacs ];

已验证的使用情况

# Open file in Emacs (terminal)
emacs file.txt

# Basic navigation (C = Ctrl, M = Alt/Esc):
# C-f           - Move forward (right)
# C-b           - Move backward (left)
# C-n           - Next line (down)
# C-p           - Previous line (up)
# C-a           - Beginning of line
# C-e           - End of line
# M-f           - Forward one word
# M-b           - Backward one word
# M-<           - Beginning of buffer
# M->           - End of buffer
# M-g g         - Go to line (prompt for line number)

# Editing:
# C-d           - Delete character under cursor
# DEL (Backspace) - Delete character before cursor
# M-d           - Delete word forward
# C-k           - Kill (cut) to end of line
# C-y           - Yank (paste)
# C-space       - Start selection (set mark)
# C-w           - Cut selected region
# M-w           - Copy selected region

# Saving and quitting:
# C-x C-s       - Save current buffer
# C-x C-w       - Save as (prompt for filename)
# C-x C-c       - Save modified buffers and exit Emacs
# C-g           - Cancel current command/prompt

Nano

Nano is a simple, user-friendly terminal-based text editor.

安装

environment.systemPackages = [ pkgs.nano ];

已验证的使用情况

# Open file in nano
nano file.txt

# Basic navigation:
# Ctrl+K        - Cut line
# Ctrl+U        - Paste line
# Ctrl+6        - Mark text (start selection)
# Ctrl+W        - Search text
# Ctrl+\        - Search and replace
# Ctrl+G        - Show help
# Ctrl+C        - Show cursor position
# Ctrl+_        - Go to line

# File operations:
# Ctrl+O        - Write file (save)
# Ctrl+X        - Exit nano
# Ctrl+R        - Read file (insert file)
# Ctrl+T        - Run spell checker
# Ctrl+J        - Justify paragraph

Neovim

Neovim is a hyperextensible Vim-based text editor.

安装

environment.systemPackages = [ pkgs.neovim ];

已验证的使用情况

# Open file in neovim
nvim file.txt

Vim

Vim is a highly configurable text editor for efficient text editing.

安装

environment.systemPackages = [ pkgs.vim ];

已验证的使用情况

# Open file in vim
vim file.txt

# Basic navigation (in normal mode):
# h,j,k,l       - Move left, down, up, right
# w,W           - Move to next word
# b,B           - Move to previous word
# 0             - Move to beginning of line
# $             - Move to end of line
# gg            - Go to first line
# G             - Go to last line
# :10           - Go to line 10

# Editing modes:
# i             - Insert mode before cursor
# a             - Insert mode after cursor
# o             - Open new line below
# O             - Open new line above
# Esc           - Return to normal mode

# Saving and quitting:
# :w            - Save file
# :q            - Quit
# :wq or :x     - Save and quit
# :q!           - Quit without saving
# ZZ            - Save and quit

Other Utilities

Hugo

Hugo is a fast static site generator.

安装

environment.systemPackages = [ pkgs.hugo ];

已验证的使用情况

# Create a new site
hugo new site my-site

# Start a local server
hugo server

Direnv

Direnv loads and unloads environment variables based on the current directory.

安装

environment.systemPackages = [ pkgs.direnv ];

已验证的使用情况

# Allow a new .envrc
direnv allow

# Show directory environment
direnv status

ShellCheck

ShellCheck is a static analysis tool for shell scripts.

安装

environment.systemPackages = [ pkgs.shellcheck ];

已验证的使用情况

# Analyze a shell script
shellcheck script.sh

jq

jq is a command-line JSON processor.

安装

environment.systemPackages = [ pkgs.jq ];

已验证的使用情况

# Pretty-print JSON
jq '.' data.json

# Extract a field
jq -r '.items[0].name' data.json

yq

yq is a command-line YAML processor.

安装

environment.systemPackages = [ pkgs.yq-go ];

已验证的使用情况

# Read a field from YAML
yq '.spec.replicas' deployment.yaml

# Update a field in place
yq -i '.spec.replicas = 3' deployment.yaml