Skip to content

Repository files navigation

NailSnake

Version License: MIT Rust CI Tests Platform: Windows | Linux | macOS

A polished, full-screen terminal snake game written in Rust. NailSnake runs on Windows, Linux, and macOS - dropping you into the alternate screen buffer with raw keyboard input, just like vim or neovim. It feels like a lightweight GUI without ever leaving your terminal.

Inspired by nsnake, rebuilt with Rust's safety guarantees, richer colour palettes, persistent high-scores, and a proper man page.


Features

Capability Detail
Cross-platform Windows Terminal, PowerShell, cmd, Linux VTs, macOS Terminal, iTerm2
Vim-like TUI Alternate screen, hidden cursor, status bar, sidebar info panel
Rich colours Truecolor, 256-colour, and basic ANSI - auto-detected or forced with --color
Safe terminal handling Restores your shell on quit, panic, or Ctrl+C
Continue game Saves an active session on quit/force-quit and offers Continue on next launch
Live resize Adapts seamlessly when the terminal window is resized
Difficulty presets Chill, Normal, Hard, Insane - each with progressive speed-up
Arcade menu nSnake-inspired main menu with settings, help, and an animated Rust-themed backdrop
Wrap mode Optional wall-wrapping instead of instant death
Persistent stats High score saved per OS config directory (see below)
Manual page man nailsnake after installing the man page

Quick start

# Run in one shot - no install needed
cargo run --release

# Or install globally
cargo install --path .

Packaging And Installers

NailSnake includes packaging helpers for release builds:

# Arch Linux package with makepkg
makepkg -f

# Linux interactive packager/installer
./installer/install-linux.sh

# Termux on Android
./installer/install-termux.sh

# macOS .pkg builder/installer
./installer/install-macos.sh
# Windows PowerShell installer
.\installer\install-windows.ps1

# cmd.exe wrapper
.\installer\install-windows.cmd

The Linux installer detects the active package manager (apt, pacman, dnf, zypper, xbps, yum, or apk) and can create .deb, .pkg.tar.zst, .rpm, .xbps, or generic .tar.gz packages. It checks prerequisites first, asks before installing missing tools, then asks again before installing the created package.

The Termux installer builds a Termux-native binary, creates a .tar.gz archive, and can install it into $PREFIX/bin.

The macOS installer creates a CLI-only .pkg that installs to /usr/local/bin and does not create an app launcher icon.

The Windows installer builds nailsnake.exe, installs it under either the current user's local Programs directory or Program Files, and updates PATH so both cmd.exe and PowerShell can run nailsnake from a new terminal window.

Linux / macOS - binary + man page

make install                    # /usr/local/bin + man page
# user-local (no root):
PREFIX=$HOME/.local make install
export MANPATH="$HOME/.local/share/man:${MANPATH:-}"

Or the man page alone:

./scripts/install-man.sh
# or
make install-man

Then:

man nailsnake

Windows

Build and run in Windows Terminal, PowerShell, or cmd:

cargo install --path .
nailsnake

Windows has no built-in man. Install the manual for Git Bash / MSYS2:

.\scripts\install-man.ps1 -UserLocal

Or read the man source at man/nailsnake.1, or use nailsnake --help.


Controls

Key Action
Enter Start from title screen
Arrow keys Move
W A S D Move (alternate)
Space Pause / resume
R Restart
Q / Esc Quit
Ctrl+C Force quit (terminal restored)

CLI options

nailsnake [OPTIONS]

Options:
  -d, --difficulty <DIFFICULTY>  chill | normal | hard | insane [default: normal]
  -w, --wrap                     wrap around walls
  -c, --color <COLOR>            auto | truecolor | 256 | basic [default: auto]
  -g, --grid                     show grid dots
      --about                    print project information
  -h, --help                     print help (see also: man nailsnake)
  -V, --version                  print version

Examples

# Casual
nailsnake

# Bring the heat
nailsnake -d hard --wrap --grid

# Force a specific colour mode
nailsnake --color truecolor

# Print project metadata
nailsnake --about

# Read the full manual
man nailsnake

Stats file locations

OS Path
Linux / BSD ~/.config/NailSnake/stats.json
macOS ~/Library/Application Support/NailSnake/stats.json
Windows %APPDATA%\NailSnake\stats.json

Active game resume data is stored separately from stats as active-game.json in the platform data directory. See docs/persistence.md.


Requirements

  • Rust 1.70+ (edition 2021)
  • Terminal at least 60x22 characters
  • Interactive TTY (not a piped or scripted session)
  • Startup resource preflight must be able to reserve a small memory buffer and inspect CPU availability

Documentation

Detailed documentation lives in docs/.

Contributing

See CONTRIBUTING.md for development setup, pull request guidelines, and code style conventions.

Security

See SECURITY.md for supported versions and how to report vulnerabilities.

Attribution

Author: Voltsparx - Contact: voltsparx@gmail.com

License

MIT - Copyright (c) 2026 Voltsparx

About

A simple CLI snake game made in Rust!

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages