nix3-registry(1)
hey bestie π«Ά welcome to the nix3-registry(1) page from the General Commands Manual β it's the main character of flake registry management, aka nix registry. no cap, this one's iconic. π
β οΈ Warning β οΈ
Warning β This program is experimental and its interface is subject to change. so if the interface shifts, that's not you, that's the vibe. π
β¨ Name β¨
nix registry β manage the flake registry. π
πΈ Synopsis πΈ
nix registry [optionβ¦] subcommand
where subcommand is one of the following:
nix registry addβ add/replace flake in user flake registrynix registry listβ list available Nix flakesnix registry pinβ pin a flake to its current version or to the current version of a flake URLnix registry removeβ remove flake from user flake registrynix registry resolveβ resolve flake references using the registry
π Description π
nix registry provides subcommands for managing flake registries. Flake registries are a convenience feature that allows you to refer to flakes using symbolic identifiers such as nixpkgs, rather than full URLs such as git://github.com/NixOS/nixpkgs. You can use these identifiers on the command line (e.g. when you do nix run nixpkgs#hello) or in flake input specifications in flake.nix files. The latter are automatically resolved to full URLs and recorded in the flakeβs flake.lock file. it's giving shorthand-slay. β¨
In addition, the flake registry allows you to redirect arbitrary flake references (e.g. github:NixOS/patchelf) to another location, such as a local fork. lowkey remix energy. π¦
There are multiple registries. These are, in order from lowest to highest precedence:
- The global registry, which is a file downloaded from the URL specified by the setting
flake-registry. It is cached locally and updated automatically when itβs older thantarball-ttlseconds. The default global registry is kept in a GitHub repository. - The system registry, which is shared by all users. The default location is
/etc/nix/registry.json. On NixOS, the system registry can be specified using the NixOS optionnix.registry. - The user registry
~/.config/nix/registry.json. This registry can be modified by commands such asnix registry pin. - Overrides specified on the command line using the option
--override-flake.
Note that the system and user registries are not used to resolve flake references in flake.nix. They are only used to resolve flake references on the command line. periodt. π
π Registry format π
A registry is a JSON file with the following format:
{
"version": 2,
"flakes": [
{
"from": {
"type": "indirect",
"id": "nixpkgs"
},
"to": {
"type": "github",
"owner": "NixOS",
"repo": "nixpkgs"
}
},
...
]
}
That is, it contains a list of objects with attributes from and to, both of which contain a flake reference in attribute representation. (For example, {"type": "indirect", "id": "nixpkgs"} is the attribute representation of nixpkgs, while {"type": "github", "owner": "NixOS", "repo": "nixpkgs"} is the attribute representation of github:NixOS/nixpkgs.)
Given some flake reference R, a registry entry is used if its from flake reference matches R. R is then replaced by the unification of the to flake reference with R. match made in registry heaven. π
π Matching π
The from flake reference in a registry entry matches some flake reference R if the attributes in from are the same as the attributes in R. For example:
nixpkgsmatches withnixpkgs.nixpkgsmatches withnixpkgs/nixos-20.09.nixpkgs/nixos-20.09does not match withnixpkgs.nixpkgsdoes not match withgit://github.com/NixOS/patchelf.
π§© Unification π§©
The to flake reference in a registry entry is unified with some flake reference R by taking to and applying the rev and ref attributes from R, if specified. For example:
github:NixOS/nixpkgsunified withnixpkgsproducesgithub:NixOS/nixpkgs.github:NixOS/nixpkgsunified withnixpkgs/nixos-20.09producesgithub:NixOS/nixpkgs/nixos-20.09.github:NixOS/nixpkgs/masterunified withnixpkgs/nixos-20.09producesgithub:NixOS/nixpkgs/nixos-20.09.
βοΈ Options βοΈ
πΈ Logging-related options πΈ
--debugβ Set the logging verbosity level to βdebugβ.--log-formatformatβ Set the format of log output; one ofraw,internal-json,barorbar-with-logs.--print-build-logs,-Lβ Print full build logs on standard error.--quietβ Decrease the logging verbosity level.--verbose,-vβ Increase the logging verbosity level.
π Miscellaneous global options π
--helpβ Show usage information.--offlineβ Disable substituters and consider all previously downloaded files up-to-date.--optionnamevalueβ Set the Nix configuration settingnametovalue(overridingnix.conf).--refreshβ Consider all previously downloaded files out-of-date.--versionβ Show version information.
Note β See man nix.conf for overriding configuration settings with command line flags.
xoxo bestie π β the footer on this one is just nix3-registry(1), so that's a wrap. πβ¨
π¦ where this page comes from
- fedora 44: nix-core 2.35.3-2.fc44 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms