nix3-formatter-run(1)
π nix3-formatter-run(1) β the Nix manual, bestie edition β¨
okay so you're reading the manual page for nix3-formatter-run(1) from the Nix general commands manual, and honestly? it's giving glow-up-for-your-code. let's go π«Ά
β οΈ Warning β this program is experimental and its interface is subject to change. no cap. treat it like a situationship, not a marriage π
πΈ Name πΈ
nix formatter run β reformat your code in the standard style β¨ (basically it makes your files pretty, but like, correctly pretty, not just vibes)
π Synopsis π
nix formatter run [optionβ¦] argsβ¦
π¦ Description π¦
so nix fmt (which is literally just an alias for nix formatter run, same girl different name π
) calls the formatter that's specified in the flake. that's it. that's the whole job.
want to send some flags to the formatter itself? use -- and then the flags. that's the doorway πͺβ¨
any arguments you pass get forwarded to the formatter too. bestie, typically those are the files you want formatted. like, the whole point.
also!!! the environment variable PRJ_ROOT (according to prj-spec) will be set to the absolute path to the directory containing the closest parent flake.nix relative to the current directory. it goes looking upward for its home π π
π Example π
want to use the official Nix formatter? say less:
# flake.nix
{
outputs = { nixpkgs, self }: {
formatter.x86_64-linux = nixpkgs.legacyPackages.${system}.nixfmt-tree;
};
}
iconic. periodt. π
β¨ Options β¨
--jsonβ produce output in JSON format, suitable for consumption by another program. feeding the robots π€--no-prettyβ print compact JSON output on a single line, even when the output is a terminal. some commands may print multiple JSON objects on separate lines. see--pretty.--prettyβ print multi-line, indented JSON output for readability.- Default: indent if output is to a terminal.
- This option is only effective when
--jsonis also specified. (no--json, no party π)
π Common evaluation options π
--argname expr β pass the value expr as the argument name to Nix functions.--arg-from-filename path β pass the contents of file path as the argument name to Nix functions.--arg-from-stdinname β pass the contents of stdin as the argument name to Nix functions.--argstrname string β pass the string string as the argument name to Nix functions.--debuggerβ start an interactive environment if evaluation fails. it's giving "we'll figure it out together" π«--eval-storestore-url β the URL of the Nix store to use for evaluation, i.e. to store derivations (.drvfiles) and inputs referenced by them.--impureβ allow access to mutable paths and repositories. living dangerously, we love that for you πβ¨--include/-Ipath β add path to search path entries used to resolve lookup paths.- This option may be given multiple times.
- Paths added through
-Itake precedence over thenix-pathconfiguration setting and theNIX_PATHenvironment variable. she's got seniority π
--override-flakeoriginal-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. commitment issues? not today π--inputs-fromflake-url β use the inputs of the specified flake as registry entries.--no-registriesβ don't allow lookups in the flake registries.
DEPRECATED β use --no-use-registries instead. she's retired, let her rest π
--no-update-lock-fileβ do not allow any updates to the flake's lock file.--no-write-lock-fileβ do not write the flake's newly generated lock file.--output-lock-fileflake-lock-path β write the given lock file instead offlake.lockwithin the top-level flake.--override-inputinput-path flake-url β override a specific flake input (e.g.dwarffs/nixpkgs). the input path must not be empty. this implies--no-write-lock-file.--recreate-lock-fileβ recreate the flake's lock file from scratch.
DEPRECATED β use nix flake update instead. ok boo, we've moved on π«Ά
--reference-lock-fileflake-lock-path β read the given lock file instead offlake.lockwithin the top-level flake.--update-inputinput-path β update a specific flake input (ignoring its previous entry in the lock file).
DEPRECATED β use nix flake update instead. same energy, new era β¨
π Logging-related options π
--debugβ set the logging verbosity level todebug.--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. shhh π€«--verbose/-vβ increase the logging verbosity level. tell me EVERYTHING π
π Miscellaneous global options π
--helpβ show usage information.--offlineβ disable substituters and consider all previously downloaded files up-to-date.--optionname value β set the Nix configuration setting name to value (overridingnix.conf).--refreshβ consider all previously downloaded files out-of-date.--repairβ during evaluation, rewrite missing or corrupted files in the Nix store. during building, rebuild missing or corrupted store paths. she's a healer π©Ή--versionβ show version information.
π Options that change the interpretation of installables π
--exprexpr β interpret installables as attribute paths relative to the Nix expression expr.--file/-ffile β interpret installables as attribute paths relative to the Nix expression stored in file. if file is the character-, then a Nix expression is read from standard input. implies--impure.
Note β see man nix.conf for overriding configuration settings with command line flags.
and that's the whole page bestie, you ate that π«Ά hope your code comes out β¨immaculateβ¨. this was nix3-formatter-run(1) from the Nix general commands manual β go forth and format, main character π
π
π¦ 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