Note
Flake schemas are not yet supported in Nix. You can track ongoing work in this pull request against the upstream project. Until that merges, you can experiment with flake schemas using a candidate version of Nix.
This Nix flake provides a set of schema definitions for commonly used flake output types.
It's used by default for flakes that do not have a schemas
output.
It supports the following flake output types:
apps
checks
darwinConfigurations
darwinModules
devShells
dockerImages
formatter
homeConfigurations
homeModules
hydraJobs
legacyPackages
nixosConfigurations
nixosModules
overlays
packages
schemas
templates
Flake schemas are not yet supported in Nix. To experiment with them, you can use the version of Nix from the pull request to upstream. Below are some example commands.
Warning
The first time you run one of the commands, you will build Nix in its entirety, which is resource instensive and could take a while.
# Display the flake schema for this repo
nix run github:DeterminateSystems/nix-src/flake-schemas -- \
flake show "https://flakehub.com/f/DeterminateSystems/flake-schemas/*"
# Display the flake schema for this repo as JSON
nix run github:DeterminateSystems/nix-src/flake-schemas -- \
flake show --json "https://flakehub.com/f/DeterminateSystems/flake-schemas/*"
# Display the flake schema for Nixpkgs
nix run github:DeterminateSystems/nix-src/flake-schemas -- \
flake show "https://flakehub.com/f/NixOS/nixpkgs/*"
# Display the flake schema for Nixpkgs as JSON
nix run github:DeterminateSystems/nix-src/flake-schemas -- \
flake show --json "https://flakehub.com/f/NixOS/nixpkgs/*"
- Flake schemas: Making flake outputs extensible — the blog post introducing flake schemas.
- Flake schemas — Eelco Dolstra's talk on flake schemas at NixCon 2023.