Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
ada2250
Flake schemas
edolstra Sep 30, 2025
ebfd598
Merge remote-tracking branch 'detsys/main' into flake-schemas-detsys
edolstra Oct 8, 2025
a9414c7
nix flake show: Restore separation between traversal and rendering
edolstra Oct 8, 2025
1e12ad0
Merge remote-tracking branch 'detsys/main' into flake-schemas-detsys
edolstra Oct 20, 2025
9a1a075
nix flake show: Restore parallelism
edolstra Oct 20, 2025
e5797f8
nix flake check: Restore parallelism
edolstra Oct 20, 2025
713b2c2
Fix computeStorePath() default argument
edolstra Oct 21, 2025
f5c5c7d
Don't copy the default schemas flake to the store
edolstra Oct 21, 2025
46aa449
Merge remote-tracking branch 'detsys/main' into flake-schemas-detsys
edolstra Oct 21, 2025
fb58ac4
Merge remote-tracking branch 'detsys/main' into flake-schemas-detsys
edolstra Oct 21, 2025
8383f05
Merge remote-tracking branch 'detsys/main' into flake-schemas-detsys
edolstra Oct 22, 2025
adf137a
Merge remote-tracking branch 'detsys/main' into flake-schemas-detsys
edolstra Nov 5, 2025
ed822c7
nix flake show: Add version field
edolstra Nov 7, 2025
3634372
Don't filter out empty descriptions
edolstra Nov 7, 2025
6de1f6d
Refactor
edolstra Nov 7, 2025
7cf73e7
nix flake show: Include forSystems attribute
edolstra Nov 7, 2025
d1c55b9
nix flake show: Add flags for including derivation/output paths
edolstra Nov 10, 2025
3be05f8
nix flake show --json: Format improvements
edolstra Nov 10, 2025
3a2d1a6
Sync with flake-schemas v0.2.0
edolstra Nov 10, 2025
50801e8
nix flake show: Fix
edolstra Nov 10, 2025
ec31e8b
Use nix flake show in flake-regressions
edolstra Nov 10, 2025
7cb6c70
Fix call to logError()
edolstra Nov 10, 2025
c2f305b
Merge remote-tracking branch 'detsys/main' into flake-schemas-detsys
edolstra Nov 10, 2025
f39b9da
nix flake show: Improve rendering of unknown/legacy outputs
edolstra Nov 11, 2025
e15504e
nix flake check: Add --build-all flag
edolstra Nov 12, 2025
4e2cb80
nix flake check: Show failing/succeeding outputs
edolstra Nov 12, 2025
939bae4
Drop temporary flake-regressions branches
edolstra Nov 12, 2025
8d87b35
BuildResult::Failure::rethrow(): Show status
edolstra Nov 13, 2025
739107e
BuildResult: Add a "Cancelled" status
edolstra Nov 13, 2025
a667488
nix flake check: Show which outputs failed or succeeded
edolstra Nov 13, 2025
b097e0d
Merge remote-tracking branch 'detsys/main' into flake-schemas-detsys
edolstra Feb 2, 2026
6ff3260
Merge remote-tracking branch 'detsys/main' into flake-schemas-detsys
edolstra Feb 3, 2026
da9cf40
Merge remote-tracking branch 'detsys/main' into flake-schemas-detsys
edolstra Feb 11, 2026
c145c90
Merge remote-tracking branch 'detsys/main' into flake-schemas-detsys
edolstra Feb 12, 2026
f2e8767
Merge remote-tracking branch 'detsys/main' into flake-schemas-detsys
edolstra Feb 12, 2026
6aee6f4
Implement nix-search role
edolstra Feb 12, 2026
cd803fb
Add test for `nix search` on flakes
edolstra Feb 12, 2026
7b8ad30
Merge remote-tracking branch 'detsys/main' into flake-schemas-detsys
edolstra Feb 13, 2026
fdcfff6
Remove FIXMEs
edolstra Feb 13, 2026
d63dc7e
Fix test
edolstra Feb 13, 2026
f98ba61
Merge remote-tracking branch 'detsys/main' into flake-schemas-detsys
edolstra Feb 23, 2026
e07a31d
Merge remote-tracking branch 'detsys/main' into flake-schemas-detsys
edolstra Feb 23, 2026
27285a2
Merge remote-tracking branch 'detsys/main' into flake-schemas-detsys
edolstra Feb 24, 2026
0f5ad3a
InstallableFlake: Fix tab completion
edolstra Feb 25, 2026
a26e02d
Remove unused NIX_ALLOW_EVAL
edolstra Feb 25, 2026
f6b5b0f
Use openEvalCache()
edolstra Feb 25, 2026
c6a74e3
Respect the allowIFD flake schema attribute
edolstra Feb 25, 2026
00ff879
Remove FIXME that currently does not apply
edolstra Feb 25, 2026
56740c1
Remove nonsense FIXME
edolstra Feb 25, 2026
863de31
Newline
edolstra Feb 25, 2026
fdb57e4
Simplify test
edolstra Feb 25, 2026
bddf35a
Typo
edolstra Feb 25, 2026
d2bb664
Restore _NIX_TEST_BARF_ON_UNCACHEABLE
edolstra Feb 25, 2026
051b3c5
Drop FIXME
edolstra Feb 25, 2026
26809c3
flake.outputs -> outputs
edolstra Feb 25, 2026
f68fe29
show.sh: Remove test that `packages` is allowed to contain non-deriva…
edolstra Feb 25, 2026
e11ee51
Show activity for flake checks
edolstra Feb 25, 2026
e790744
Remove unused openEvalCache()
edolstra Feb 25, 2026
466b470
nix flake show: Make --drv-paths / --output-paths require --json
edolstra Feb 26, 2026
3f1b906
Fix names
edolstra Feb 26, 2026
b5a3c50
Use all available schemas for error messages
edolstra Feb 26, 2026
b3eb0bf
coderabbit review
edolstra Feb 26, 2026
c40cccf
Fix handling of unknown outputs
edolstra Feb 27, 2026
2c7ef04
Change the `derivation` schema attribute to `derivationAttrPath`
edolstra Feb 27, 2026
4aadc97
call-flake-schemas.nix: Drop rec
edolstra Feb 27, 2026
90e9f41
Backward compatibility support for the derivation schema attribute
edolstra Feb 27, 2026
943f1a5
nix flake show: Fix derivation name rendering
edolstra Feb 27, 2026
e28d06b
nix flake show: Add --drv-names flag
edolstra Feb 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ jobs:
- name: Checkout flake-regressions
uses: actions/checkout@v4
with:
repository: DeterminateSystems/flake-regressions
repository: NixOS/flake-regressions
path: flake-regressions
- name: Checkout flake-regressions-data
uses: actions/checkout@v4
with:
repository: DeterminateSystems/flake-regressions-data
repository: NixOS/flake-regressions-data
path: flake-regressions/tests
- uses: DeterminateSystems/determinate-nix-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
Expand All @@ -160,6 +160,7 @@ jobs:
FLAKE_REGRESSION_GLOB: ${{ matrix.glob }}
NIX_CONFIG: ${{ matrix.nix_config }}
PREFETCH: "1"
USE_NIX_FLAKE_SHOW: "1"
run: |
set -x
echo "PARALLEL: $PARALLEL"
Expand Down
1 change: 1 addition & 0 deletions doc/manual/source/SUMMARY.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
- [Nix Archive (NAR) Format](protocols/nix-archive/index.md)
- [Derivation "ATerm" file format](protocols/derivation-aterm.md)
- [`builtins.wasm` Host Interface](protocols/wasm.md)
- [Flake Schemas](protocols/flake-schemas.md)
- [C API](c-api.md)
- [Glossary](glossary.md)
- [Development](development/index.md)
Expand Down
64 changes: 64 additions & 0 deletions doc/manual/source/protocols/flake-schemas.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Flake Schemas

Flake schemas are a mechanism to allow tools like `nix flake show` and `nix flake check` to enumerate and check the contents of a flake
in a generic way, without requiring built-in knowledge of specific flake output types like `packages` or `nixosConfigurations`.

A flake can define schemas for its outputs by defining a `schemas` output. `schemas` should be an attribute set with an attribute for
every output type that you want to be supported. If a flake does not have a `schemas` attribute, Nix uses a built-in set of schemas (namely https://github.com/DeterminateSystems/flake-schemas).

A schema is an attribute set with the following attributes:

| Attribute | Description | Default |
| :---------- | :---------------------------------------------------------------------------------------------- | :------ |
| `version` | Should be set to 1 | |
| `doc` | A string containing documentation about the flake output type in Markdown format. | |
| `allowIFD` | Whether the evaluation of the output attributes of this flake can read from derivation outputs. | `true` |
| `inventory` | A function that returns the contents of the flake output (described [below](#inventory)). | |

# Inventory

The `inventory` function returns a _node_ describing the contents of the flake output. A node is either a _leaf node_ or a _non-leaf node_. This allows nested flake output attributes to be described (e.g. `x86_64-linux.hello` inside a `packages` output).

Non-leaf nodes must have the following attribute:

| Attribute | Description |
| :--------- | :------------------------------------------------------------------------------------- |
| `children` | An attribute set of nodes. If this attribute is missing, the attribute is a leaf node. |

Leaf nodes can have the following attributes:

| Attribute | Description |
| :------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `derivationAttrPath` | If not null, a list of strings denoting the attribute path of the "main" derivation of this node. |
| `evalChecks` | An attribute set of Boolean values, used by `nix flake check`. Each attribute must evaluate to `true`. |
| `isFlakeCheck` | Whether `nix flake check` should build the attribute denoted by `derivationAttrPath`. |
| `shortDescription` | A one-sentence description of the node (such as the `meta.description` attribute in Nixpkgs). |
| `what` | A brief human-readable string describing the type of the node, e.g. `"package"` or `"development environment"`. This is used by tools like `nix flake show` to describe the contents of a flake. |

Both leaf and non-leaf nodes can have the following attributes:

| Attribute | Description |
| :----------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `forSystems` | A list of Nix system types (e.g. `["x86_64-linux"]`) supported by this node. This is used by tools to skip nodes that cannot be built on the user's system. Setting this on a non-leaf node allows all the children to be skipped, regardless of the `forSystems` attributes of the children. If this attribute is not set, the node is never skipped. |

# Example

Here is a schema that checks that every element of the `nixosConfigurations` flake output evaluates and builds correctly (meaning that it has a `config.system.build.toplevel` attribute that yields a buildable derivation).

```nix
outputs = {
schemas.nixosConfigurations = {
version = 1;
doc = ''
The `nixosConfigurations` flake output defines NixOS system configurations.
'';
inventory = output: {
children = builtins.mapAttrs (configName: machine:
{
what = "NixOS configuration";
derivationAttrPath = [ "config" "system" "build" "toplevel" ];
}) output;
};
};
};
```
Loading