Files
org-roam/20251105080253-nix_flake.org
2025-11-05 09:18:11 +01:00

1.4 KiB

nix-flake

Nix flakes provide a standard way to write Nix expressions (and therefore packages) whose dependencies are version-pinned in a lock file, improving reproducibility of nix installations. The experimental nix command-line interface (CLI) lets you evaluate or build an expression contained within a flake, install a derivation from a flake into a User Environment, and operate on flake outputs much like the original nix-{build,eval,…} commands would.

A flake refers to a file-system tree whose root directory contains the Nix file specification called flake.nix. An installation may contain any number of flakes, independent of each other or even call each other. The contents of flake.nix file follow the uniform naming schema for expressing packages and dependencies on Nix. Flakes use the standard Nix protocols, including the URL-like syntax for specifying repositories and package names. To simplify the long URL syntax with shorter names, flakes uses a registry of symbolic identifiers. Flakes also allow for locking references and versions that can then be easily queried and updated programmatically. Nix command-line interface accepts flake references for expressions that build, run, and deploy packages.