NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.05k stars 13.38k forks source link

Proposal: `## devspec` for machine readable development/maintenance metadata #306506

Open roberth opened 4 months ago

roberth commented 4 months ago

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

Draft

Example:

## devspec
# documentation:
#   - ../doc/foo-bar.md
# tests:
#   - /pkgs/tests/foo/bar.nix
# test-commands:
#   - nix-build -A tests.foo.bar
#   - nix-build -A nixosTests.foo-bar
# maintainers:
#   - alice
#   - bob
# ---

Then any tooling can use the info. Standard fields:

All paths are "relative URLs" (which include paths) that are resolved relative to the base directory, but / refers to the root of the project (ie Nixpkgs) instead of the system root.

Implementation steps:


Add a :+1: reaction to issues you find important.

philiptaron commented 3 months ago

Robert, I think I'd like to use the currently unused shebang at the top of these files for testing purposes, so that when you ran the file it'd run the tests for the file.

roberth commented 3 months ago

That's an interesting idea, but it is a bit less capable.

More subjectively, I also expect that bundling it with the other attributes makes it a nice, coherent experience that's similar to the package tests and meta attributes.

SuperSandro2000 commented 3 months ago
  • The lines after are s/^# / / and parsed as yaml, until # --- is encountered or a line that doesn't start with #

we should limit that to a very limited subset of yaml, like only lists of strings. Otherwise we might run into subtle differences between yaml 1.1 and 1.2 or some other less fun parsing things.