nix3-flake-lock(1)

create missing lock file entries Cnix flake lock [option] flake-url Update the Cnixpkgs and Cnix inputs of the flake in

Section 1 nix-bin bookworm source

Description

nix3-flake-lock

Warning: This program is experimental and its interface is subject to change.

Name

nix flake lock - create missing lock file entries

Synopsis

nix flake lock [option…] flake-url

Examples

Update the nixpkgs and nix inputs of the flake in the current directory:

# nix flake lock --update-input nixpkgs --update-input nix
* Updated ’nix’: ’github:NixOS/nix/9fab14adbc3810d5cc1f88672fde1eee4358405c’ -> ’github:NixOS/nix/8927cba62f5afb33b01016d5c4f7f8b7d0adde3c’
* Updated ’nixpkgs’: ’github:NixOS/nixpkgs/3d2d8f281a27d466fa54b469b5993f7dde198375’ -> ’github:NixOS/nixpkgs/a3a3dda3bacf61e8a39258a0ed9c924eeca8e293’

Description

This command updates the lock file of a flake (flake.lock) so that it contains a lock for every flake input specified in flake.nix. Existing lock file entries are not updated unless required by a flag such as --update-input.

Note that every command that operates on a flake will also update the lock file if needed, and supports the same flags. Therefore,

# nix flake lock --update-input nixpkgs
# nix build

is equivalent to:

# nix build --update-input nixpkgs

Thus, this command is only useful if you want to update the lock file separately from any other action such as building.

Options

Common evaluation options:

--arg name expr

Pass the value expr as the argument name to Nix functions.

--argstr name string

Pass the string string as the argument name to Nix functions.

--eval-store store-url

The Nix store to use for evaluations.

--impure

Allow access to mutable paths and repositories.

--include / -I path

Add path to the list of locations used to look up <...> file names.

--override-flake original-ref resolved-ref

Override the flake registries, redirecting original-ref to resolved-ref.

Common flake-related options:

--commit-lock-file

Commit changes to the flake’s lock file.

--inputs-from flake-url

Use the inputs of the specified flake as registry entries.

--no-registries

Don’t allow lookups in the flake registries. This option is deprecated; use --no-use-registries.

--no-update-lock-file

Do not allow any updates to the flake’s lock file.

--override-input input-path flake-url

Override a specific flake input (e.g. dwarffs/nixpkgs). This implies --no-write-lock-file.

--recreate-lock-file

Recreate the flake’s lock file from scratch.

--update-input input-path

Update a specific flake input (ignoring its previous entry in the lock file).