LinuxCommandLibrary

nix-classic

Run Nix expressions in the classic evaluator

TLDR

Search for a package in nixpkgs via its name

$ nix-env [[-qaP|--query --available --attr-path]] [search_term_regex]
copy

Start a shell with the specified packages available
$ nix-shell [[-p|--packages]] [pkg1 pkg2 pkg3 ...]
copy

Install some packages permanently
$ nix-env [[-iA|--install --attr]] [nixpkgs.pkg1 nixpkgs.pkg2 ...]
copy

Show all dependencies of a store path (package), in a tree format
$ nix-store [[-q|--query]] --tree /nix/store/[checksum-package-version.ext]
copy

Update the channels (repositories)
$ nix-channel --update
copy

Remove unused paths from Nix store
$ nix-collect-garbage
copy

SYNOPSIS

nix-classic subcommand [options...]
(e.g., nix-classic build [options...], nix-classic env [options...])

This synopsis represents the usage of the classic Nix commands, which nix-classic refers to. The actual nix-classic command itself, if it exists as a wrapper, typically dispatches to these specific tools.

PARAMETERS

build
    Invokes functionality similar to nix-build for building derivations.

env
    Invokes functionality similar to nix-env for managing user environments.

store
    Invokes functionality similar to nix-store for low-level Nix store operations.

shell
    Invokes functionality similar to nix-shell for creating ad-hoc development environments.

instantiate
    Invokes functionality similar to nix-instantiate for evaluating Nix expressions.

collect-garbage
    Invokes functionality similar to nix-collect-garbage for cleaning up the Nix store.

copy-closure
    Invokes functionality similar to nix-copy-closure for copying derivations to a remote machine.

DESCRIPTION

nix-classic conceptually represents the traditional command-line interface of the Nix package manager, comprising individual executables like nix-build, nix-env, nix-store, nix-shell, and nix-instantiate. Before the introduction of the unified nix command (e.g., nix build, nix run), these distinct tools were the primary way to interact with Nix. The term nix-classic is often used to differentiate this older paradigm from the modern, streamlined nix CLI, either as an alias or a wrapper script, to provide backward compatibility or to access specific advanced functionalities that are more exposed in the classic interface.

CAVEATS

Legacy Interface: nix-classic refers to an older, less unified command-line interface. New users are generally encouraged to use the modern, unified nix command for most operations (e.g., nix build instead of nix-build).
Availability: The nix-classic executable itself might not be directly available on all Nix installations; it's often a conceptual grouping or an alias for the direct nix-* binaries. Functionality is accessed via the individual classic commands.

UNIFIED VS. CLASSIC CLI

The Nix ecosystem has two primary command-line interfaces: the classic one (accessed via distinct nix-* executables, or conceptually through nix-classic) and the unified one (via nix ). The unified CLI aims for greater consistency and user-friendliness across common operations.

BACKWARD COMPATIBILITY

The classic commands are maintained largely for backward compatibility with existing scripts and user muscle memory. Many advanced features and low-level operations are still most directly accessible through the classic interfaces.

HISTORY

The concept of nix-classic arose with the significant evolution of the Nix command-line interface. Before Nix 2.0, all interactions were through distinct binaries like nix-build, nix-env, nix-store, etc. With the introduction and maturation of the unified nix command (e.g., nix build, nix shell, nix run), these older commands were grouped under the informal "classic" designation. This distinction became important to manage the transition and provide clarity, allowing users to choose between the older, well-established interface and the newer, more consistent one. While the new CLI is the recommended path for most tasks, the classic commands remain fully supported and essential for certain advanced or specific use cases.

SEE ALSO

nix(1), nix-build(1), nix-env(1), nix-store(1), nix-shell(1), nix-instantiate(1)

Copied to clipboard