nix-lint

Last updated: 2019-04-14 15:59:37 +0100

Upstream URL: git clone http://chriswarbo.net/git/nix-lint.git

Repo

View repository

View issue tracker

Contents of README follows


Nix Lint

This package provides a linter for the Nix expression language (used by the Nix package manager and associated tools).

Invocation

The main way to use this tool is to run the nix-lint executable. This will read Nix source code from standard input, write suggestions about the code to standard output in a simple JSON format, and write errors which prevented the linting from working (e.g. unparseable source code) to standard error. specifically do not supp

nix-lint will exit with code 0 if no errors were encountered and no suggestions were made; exit code 1 if errors prevented linting; or 2 if no errors were encountered and suggestions were made.

Control over linting (e.g. enabling/disabling certain checks) can be achieved by setting environment variables (TODO).

We expose all of our innards as a Haskell library, in case it’s useful to anyone; for example, to write custom checking functions.

Anti-Features

nix-lint specifically does not provide any of the following functionality, since the author feels it is either unneeded bloat, better performed by some other tool, or subjective enough that users may prefer to do it themselves (e.g. with a wrapper script):

Checks

The following checks are supported. All checks are enabled by default; to disable a check add its ID to the NIX_LINT_DISABLE environment variable.