The om health command checks the health of your Nix install. Furthermore, individual projects can configure their own health checks in their flake.nix. For example, the nammayatri project checks that the cachix cache is in use.
Checks performed
| Check | Configurable in flake.nix? |
|---|---|
| Flakes are enabled | - |
| Nix version is supported | Yes |
| Nix runs natively (no rosetta) 1 | Yes |
Builds use multiple cores (max-jobs) | Yes |
| Nix Caches in use | Yes |
| Direnv: installed and activated | Yes |
| Dotfiles are managed by Nix | Yes |
| Min RAM / Disk space | Yes |
| Homebrew install detection (disabled by default) 2 | Yes |
Note that some checks are considered non-essential. For eg., the disk space check looks for 1TB+ disk space, but if the user is on a laptop with 256GB SSD, the check will report a warning instead of failing. This can also be configured in per-project basis from flake.nix (see below).
Usage
om healthTo run use the health check configuration specified in a project flake, pass that flake as an argument. For eg., to run halth checks defined from the nammayatri project, run:
# The argument can be any flake URL (including a local path)
om health github:nammayatri/nammayatriPer-project configuration
To add project specific health checks or configure health checks, add the following to your om.yaml:
health:
default:
caches:
required:
- "https://ourproject.cachix.org"
To see all available configuration options, run om health --dump-schema. This will dump the schema of the configuration in JSON format. Convert that to YAML to see what can be added under the om.health.default key of your om.yaml.
$ om health --dump-schema | nix run nixpkgs#yq-go -- -PThis will output:
flake-enabled: {}
nix-version:
supported: '>=2.16.0'
rosetta:
enable: true
required: true
max-jobs: {}
trusted-users:
enable: false
caches:
required:
- https://cache.nixos.org/
direnv:
enable: true
required: false
homebrew:
enable: false
required: false
shell:
enable: true
required: falseAdding devShell check
You can automatically run om health as part of direnv invocation; see om develop for details.