The installables syntax is not documented in any of the man pages or docbook pages for any of those individual commands. And while these commands really should at least peripherally individually document how installables work, in the meantime we can at least direct people to the right place. This commit also clarifies the unexpected fact that `nix profile remove` and `nix profile upgrade` do *not* take installables. Change-Id: I3b1453cb197a613bbab639c66a466365c3592c6d
1.2 KiB
1.2 KiB
R""(
Note: this command's interface is based heavily around installables, which you may want to read about first (nix --help).
Examples
With nixpkgs-fmt:
# flake.nix
{
outputs = { nixpkgs, self }: {
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
};
}
-
Format the current flake:
$ nix fmt -
Format a specific folder or file:
$ nix fmt ./folder ./file.nix
With nixfmt:
# flake.nix
{
outputs = { nixpkgs, self }: {
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt;
};
}
- Format specific files:
$ nix fmt ./file1.nix ./file2.nix
With Alejandra:
# flake.nix
{
outputs = { nixpkgs, self }: {
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
};
}
-
Format the current flake:
$ nix fmt -
Format a specific folder or file:
$ nix fmt ./folder ./file.nix
Description
nix fmt will rewrite all Nix files (*.nix) to a canonical format
using the formatter specified in your flake.
)""