Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify project status in README #33

Merged
merged 3 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
8 changes: 7 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ jobs:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main

- name: Check Nix formatting
run: |
nix shell "https://flakehub.com/f/NixOS/nixpkgs/*#nixpkgs-fmt" --command \
nix shell "https://flakehub.com/f/NixOS/nixpkgs/0.2405.636988#nixpkgs-fmt" --command \
sh -c "git ls-files '*.nix' | xargs nixpkgs-fmt --check"

- name: Check links in README
run: |
nix shell "https://flakehub.com/f/NixOS/nixpkgs/0.2405.636988#lychee" --command \
lychee README.md
53 changes: 47 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,80 @@
# Flake schemas

> [!NOTE]
> Flake schemas are not yet supported in Nix.
> You can track ongoing work in [this pull request][pr] against the upstream project.
> Until that merges, you can [experiment with flake schemas](#experimenting-with-flake-schemas) using a candidate version of Nix.

This [Nix flake][flakes] 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`][apps]
* [`checks`][checks]
* [`darwinConfigurations`][darwin]
* [`darwinModules`][darwin]
* [`devShells`][develop]
* [`dockerImages`][docker]
* [`formatter`][formatter]
* [`homeConfigurations`][home]
* [`homeModules`][home]
* [`hydraJobs`][hydra]
* [`legacyPackages`][legacy]
* [`nixosConfigurations`][nixos]
* [`nixosModules`][nixosmodules]
* [`overlays`][overlays]
* [`packages`][packages]
* [`darwinConfigurations`][darwin]
* [`darwinModules`][darwin]
* [`homeConfigurations`][home]
* [`homeModules`][home]
* [`dockerImages`][docker]
* `schemas`
* [`templates`][templates]

## Experimenting with flake schemas

Flake schemas are not yet supported in Nix.
To experiment with them, you can use the version of Nix from the [pull request][pr] to upstream.
Here are some example commands, though please note that the first time you run one of these commands, you will build Nix in its entirety, which is resource instensive and could take a while:
lucperkins marked this conversation as resolved.
Show resolved Hide resolved

```shell
# 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/*"
```

## Read more

- [Flake schemas: Making flake outputs extensible][blog] — blog post introducing flake schemas.
- [Flake schemas: Making flake outputs extensible][blog] — the blog post introducing flake schemas.
- [Flake schemas][video] — [Eelco Dolstra][eelco]'s talk on flake schemas at [NixCon 2023][nixcon-2023].

[apps]: https://nix.dev/manual/nix/latest/command-ref/new-cli/nix3-run#apps
[blog]: https://determinate.systems/posts/flake-schemas
[branch]: https://github.com/DeterminateSystems/nix-src/tree/flake-schemas
[checks]: https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake-check.html
[darwin]: https://github.com/LnL7/nix-darwin
[docker]: https://nixos.org/manual/nixpkgs/stable/#sec-pkgs-dockerTools
[develop]: https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-develop.html
[eelco]: https://determinate.systems/people/eelco-dolstra
[flakes]: https://zero-to-nix.com/concepts/flakes
[formatter]: https://nix.dev/manual/nix/latest/command-ref/new-cli/nix3-fmt
[home]: https://github.com/nix-community/home-manager
[hydra]: https://github.com/NixOS/hydra
[legacy]: https://github.com/NixOS/nixpkgs/blob/d1eaf1acfce382f14d26d20e0a9342884f3127b0/flake.nix#L47-L56
[nixcon-2023]: https://2023.nixcon.org
[nixos]: https://github.com/NixOS/nixpkgs/tree/master/nixos
[nixosmodules]: https://nixos.wiki/wiki/NixOS_modules
[overlays]: https://nixos.wiki/wiki/Overlays
[packages]: https://search.nixos.org/packages
[pr]: https://github.com/NixOS/nix/pull/8892
[templates]: https://nix.dev/manual/nix/latest/command-ref/new-cli/nix3-flake-init
[video]: https://www.youtube.com/watch?v=ChaJY0V4ElM