ScriptsMay 26, 2026·3 min read

Nixpkgs — The Largest Reproducible Package Collection

A community-driven repository of over 100,000 packages for the Nix package manager, providing reproducible builds and declarative system configuration across Linux and macOS.

Agent ready

Review-first install path

This asset needs a review step. The copied prompt tells the agent to dry-run, show the writes, then proceed only after confirmation.

Needs Confirmation · 64/100Policy: confirm
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Single
Trust
Trust: Established
Entrypoint
Nixpkgs Overview
Review-first command
npx -y tokrepo@latest install 74276a46-58ba-11f1-9bc6-00163e2b0d79 --target codex

Dry-run first, confirm the writes, then run this command.

Introduction

Nixpkgs is the package collection for the Nix package manager, maintained by thousands of contributors worldwide. It provides a single repository of package definitions (called derivations) that produce bit-for-bit reproducible builds. Every package build is isolated in a sandbox, ensuring that dependency graphs are explicit and that builds work the same way on any machine.

What Nixpkgs Does

  • Defines over 100,000 packages in a single monorepo using the Nix expression language
  • Produces reproducible builds by pinning every dependency down to the compiler and libc version
  • Supports Linux (x86_64, aarch64) and macOS (Intel and Apple Silicon) from one source tree
  • Provides NixOS modules for declarative system configuration (services, users, networking)
  • Enables atomic upgrades and rollbacks so a bad update never leaves your system broken

Architecture Overview

Nixpkgs is a large Git repository of Nix expressions. Each package is a function that declares its build inputs, build script, and metadata. The Nix evaluator reads these expressions, computes a hash of all inputs (source tarballs, compilers, flags), and stores the result under /nix/store/<hash>-<name>. Because the path encodes the full dependency tree, multiple versions of the same library coexist without conflict. Hydra, the Nix CI system, pre-builds binary caches so most users download substitutes instead of compiling from source.

Self-Hosting & Configuration

  • Clone the repo: git clone https://github.com/NixOS/nixpkgs.git
  • Pin a specific commit in your project with flake.lock or niv for reproducibility
  • Override packages using overlays to patch or change build flags
  • Set up a private binary cache with nix-serve or Cachix to share builds across your team
  • Use nixos-rebuild switch to apply system-level changes on NixOS machines

Key Features

  • Bit-for-bit reproducible builds backed by content-addressed store paths
  • Atomic upgrades and rollbacks via symlink switching with no partial installs
  • Cross-compilation support for embedded and foreign architectures out of the box
  • Flakes provide hermetic project-level dependency management with a lock file
  • One of the fastest-moving open-source repos with thousands of package updates per week

Comparison with Similar Tools

  • Homebrew — user-friendly on macOS but not reproducible; Nixpkgs guarantees identical outputs across machines
  • apt / dnf — distribution-specific; Nixpkgs works across Linux distros and macOS from one source
  • Guix — similar concept using Guile Scheme; Nixpkgs has a much larger package set and community
  • Docker — isolates at the container level; Nix isolates at the package level, producing smaller closures
  • Conda — focused on Python/data-science; Nixpkgs covers the full OS stack including kernels and services

FAQ

Q: Do I need to use NixOS to benefit from Nixpkgs? A: No. You can install the Nix package manager on any Linux distro or macOS and use Nixpkgs packages alongside your system package manager.

Q: How do I update all my packages? A: Run nix flake update (if using flakes) or nix-channel --update && nix-env -u to pull the latest package definitions and upgrade.

Q: Is Nixpkgs suitable for production servers? A: Yes. NixOS is used in production by companies like Determinate Systems and Tweag for its reproducibility and rollback guarantees.

Q: How do I contribute a new package? A: Fork the nixpkgs repository, add your package derivation under the appropriate directory, and open a pull request. The Nixpkgs manual documents the conventions.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets