LinuxCommandLibrary

nix-registry

Manage Nix registries

TLDR

Pin the nixpkgs revision to the current version of the upstream repository

$ nix registry pin [nixpkgs]
copy

Pin an entry to the latest version of the branch, or a particular reivision of a GitHub repository
$ nix registry pin [entry] [github:owner/repo/branch_or_revision]
copy

Add a new entry that always points to the latest version of a GitHub repository, updating automatically
$ nix registry add [entry] [github:owner/repo]
copy

Remove a registry entry
$ nix registry remove [entry]
copy

See documentation about what Nix flake registries are
$ nix registry --help
copy

SYNOPSIS

nix-registry [--add URL] [--remove NAME] [--list] [--help]

PARAMETERS

--add URL
    Adds a new registry to the Nix configuration. URL specifies the location of the registry index file (e.g., a URL or a file path).

--remove NAME
    Removes a registry from the Nix configuration. NAME is the name of the registry to remove.

--list
    Lists the currently configured registries, including their names and URLs.

--help
    Displays help information about the `nix-registry` command.

DESCRIPTION

The `nix-registry` command is used to manage and query Nix package registries. It allows users to list available registries, add new registries, and remove existing ones. Registries provide metadata about available packages and their locations, allowing Nix to resolve dependencies and build software. Using `nix-registry` helps users configure their Nix environment to access a wider range of software sources beyond the default Nixpkgs channel. This is especially useful for accessing custom or experimental package sets, or for interacting with private registries within an organization.

Important Use Cases:
Adding and removing registries to customize package availability.
Listing active registries to understand current package sources.
Troubleshooting dependency resolution issues related to registry configuration.

CAVEATS

Modifying registries can impact dependency resolution. Ensure the added registries are trusted and contain compatible packages. Incorrect registry configurations can lead to build failures or unexpected behavior.

REGISTRY FORMAT

A Nix registry is typically defined by an index file (usually named 'nixpkgs.json' or similar). This file contains a JSON object that maps package names to their corresponding source information (e.g., URL, hash). Nix uses this information to fetch and build packages from the registry.

CONFIGURATION LOCATION

Nix registry configurations are typically stored in the Nix configuration file (nix.conf). Using `nix-registry` command will likely alter this config file.

SEE ALSO

nix(1), nix-channel(1)

Copied to clipboard