Installation

This guide covers multiple ways to install Nixi on your system.

Prerequisites

Requirement Version Notes
Lua 5.1+ LuaJIT recommended (enables FFI)
LuaSocket Latest Optional (FFI fallback available)
LuaFileSystem Latest Optional (FFI fallback available)
Nix 2.18+ Optional, for nix run

Standalone Mode (No External Dependencies)

Nixi now works without LuaSocket or LuaFileSystem! When these libraries are unavailable, Nixi automatically uses LuaJIT FFI for:

  • Filesystem operations: Directory scanning, file attributes, mkdir
  • HTTP server: TCP sockets, binding, accepting connections

This makes Nixi ideal for NixOS and systems without luarocks support.

Installation with Nix (Recommended)

Nix provides the easiest and most reliable installation experience. The project includes both shell.nix and flake.nix.

Using nix develop (Recommended)

# Clone the repository
git clone https://github.com/ijadux2/nixi.git
cd nixi

# Enter development environment with all dependencies
nix develop .

# Or with flakes enabled
nix develop

# Start the server
lua server.lua

Using flake.nix

# Clone the repository
git clone https://github.com/ijadux2/nixi.git
cd nixi

# Default shell with all dependencies
nix develop .#default

# Minimal shell
nix develop .#minimal

# Build the package
nix build
./result/bin/nixi --help

What's Included

The Nix development environment includes:

Package Description
lua5_4 Lua interpreter
luajit LuaJIT for FFI and performance
luafilesystem File system operations
luasocket HTTP server
dkjson JSON encoding/decoding
lpeg Parsing expression grammars
busted Unit testing framework

Installation with LuaRocks

LuaRocks is the Lua package manager. Install Nixi as a rock:

# Optional - for better compatibility (Nixi works without these)
luarocks install luasocket
luarocks install luafilesystem

# Install Nixi (when published)
luarocks install nixi

Global Installation (Recommended for CLI)

Install Nixi globally for command-line access from anywhere:

# Clone the repository
git clone https://github.com/ijadux2/nixi.git
cd nixi

# Run the installation script
./install.sh

# Restart your shell or source your rc file
source ~/.bashrc  # or ~/.zshrc

# Now you can use nixi from anywhere
nixi --help

This installs:

Manual Installation

Ubuntu/Debian

sudo apt-get update
sudo apt-get install lua5.4 liblua5.4-dev luarocks
# Optional dependencies (Nixi works without these)
luarocks install luasocket
luarocks install luafilesystem

macOS

brew install lua luarocks
# Optional dependencies (Nixi works without these)
luarocks install luasocket
luarocks install luafilesystem

Fedora/RHEL

sudo dnf install lua lua-devel luarocks
# Optional dependencies (Nixi works without these)
luarocks install luasocket
luarocks install luafilesystem

Environment Variables

Variable Default Description
NIXI_HOST 0.0.0.0 Server bind address
NIXI_PORT 3000 Server port
NIXI_ENV production Environment mode

Verify Installation

# Run the doctor command
./bin/nixi doctor