Skip to content

pkgs: Add config.derivationMeta#466932

Draft
roberth wants to merge 1 commit intoNixOS:masterfrom
roberth:derivation-meta
Draft

pkgs: Add config.derivationMeta#466932
roberth wants to merge 1 commit intoNixOS:masterfrom
roberth:derivation-meta

Conversation

@roberth
Copy link
Member

@roberth roberth commented Dec 1, 2025

Enables support for the proposed derivation-meta feature in Nix, allowing derivations to convey metadata without affecting output hashing and causing mass rebuilds.
Dropping meta has been Nixpkgs' responsibility, so to expose it to Nix we need this opt-in.

This functionality helps with

  • Implementing meta.timeout correctly
  • SBOMs
  • Analyzing licenses directly, etc

Context

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

Enables support for the proposed `derivation-meta` feature in Nix,
allowing derivations to convey metadata without affecting output
hashing and causing mass rebuilds.
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 6.topic: stdenv Standard environment labels Dec 1, 2025
@raboof
Copy link
Member

raboof commented Jan 16, 2026

while this is cool work, I'm not entirely convinced the pros and cons weigh up: if I understand correctly, the advantage of this approach over #420575 is that it avoids (mass) rebuilds when only the (exposed) metadata for a package is changed. While that's attractive, requiring a whole new nix feature for it seems rather heavy: it adds complexity to nix, and would likely require a substantial testing/stabilization process before it could be enabled by default in nixpkgs.

I wonder if it wouldn't make more sense to do something along the lines of #420575 , and in parallel focus on content-addressed derivations for reducing rebuilds? that will also take a long time to stabilize, but it will reduce mass rebuilds not only for metadata changes but for a much wider range of 'irrelevant' changes.

In any case, either this approach or renewed activity on ca-derivations could be great, but perhaps we shouldn't allow it to block #420575 ?

@roberth
Copy link
Member Author

roberth commented Jan 16, 2026

whole new nix feature

adds complexity to nix

Barely any. If anything it makes Nix more predictable because this further breaks down the myth that outputs would have unique derivations that create them.

a substantial testing/stabilization process

It's a small feature, unlike the easier-to-understand work like the new CLI or Flakes that you're used to thinking about.

and in parallel focus on content-addressed derivations for reducing rebuilds?

I wouldn't have realized (both meanings) this possibility if it wasn't for documentation work on CA.

ca-derivations is a larger feature, and its experimental phase has shown the need for multiple changes.
Modulo meta is simpler and could easily be completed before CA derivations, with minimal effort.

Also note that hash modulo is orthogonal to CA derivations, and even when we have CA derivations, input addressing will still serve its own purpose for builds that do not have rewritable outputs, or which don't have the right workarounds in place.

So we have three features of increasing complexity and usefulness.

  1. meta in output hash
  2. meta outside output hash
  3. ca derivations

2 and 3 are mutually beneficial, but 1 -> 2 requires changes in derivation tooling.

Doing 2 and 3 is less total work than 1, 2 and 3, and skipping 2 means we have some unnecessary rebuilds and no progress on the timeouts issue.

I strongly suggest we do 2 and 3, but if we urgently need a temporary meta extraction functionality, I won't stop you from also doing 1 if you accept that the format will be improved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: stdenv Standard environment 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux.

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants