How can I test the syntax of a single nix file?

Viewed 6

How can I test the syntax of a single nix file? To check if it compiles correctly.

Often I'm working on a Nixos config and it would be useful to have a faster way to check for syntax errors as opposed to nixos-rebuild build as it takes at least a few seconds.

1 Answers

Syntax/compile errors will be shown with the following command:

nix repl 'path/to/file.nix'

Related