2023-08-08 Nixpkgs Architecture Team Meeting #42

Agenda/Notes

RFC 140

Packages Modules WG

Nixpkgs CLI working group search: Nixpkgs CLI Working Group Member Search

  • 3 people are interested.
  • Let’s leave it up to the people in the thread to start it

pkg.drvPath string context / DrvDeep

Inquiry by @roberth. Nix team proposes to change the semantics of .drvPath not in Nix but in Nixpkgs. Nix team believes it is a strange behavior and should be changed as far as users are concerned.

Current semantics:

  • String context of drvPath contains the .drv file and referenced .drv files transitively and the outputs and the outputs of all build dependencies transitively.
    Proposed semantics:
  • String context of drvPath contains the .drv file and referenced .drv files transitively.

We can not change this in Nix builtins.derivation{,Strict} because that would break old expressions.
Hence the proposal to use the Nixpkgs pin to make the change.

Proposed change in Nixpkgs:

  • Change mkDerivation to apply builtins.unsafeDiscardOutputDependency, which is not unsafe but applies exactly the proposed change in semantics.
    • For input-addressed derivations it is possible to extract output paths without context, but we believe this does not defy anyone’s expectations.
  • Check usages of .drvPath in Nixpkgs itself

Impact mitigations:

  • Allow users to revert their pin of Nixpkgs while they track down the effect of the change. (grep -F .drvPath, nix-diff?)
    • We expect most usages to be in “advanced functions” which we expect to be comparatively rare outside nixpkgs.
  • Add builtins.addDrvOutputDependencies to recover the old semantics where users need it.

Discussion

  • @infinisil: This could break user tooling, and it won’t emit a warning
  • @infinisil: If they reference a .drv they probably would’ve already stripped the output deps anyway
  • @infinisil: How about drvPath2? For the migration
    • Deprecate drvPath and refer users to new attr
  • @roberth drvFile?
  • @infinisil: nix-build, nix repl use drvPath though, so it’s hard to deprecate
  • @roberth: Can deprecate drvPath when Nix relies on outputs etc only
  • @infinisil: That’s the proper way to make this change
  • @infinisil: drvPath is a Nix feature, used by Nix, changing the behavior in Nixpkgs has the same effects as changing it in Nix itself, needs to be properly deprecated in Nix itself
  • Relates to https://github.com/NixOS/rfcs/pull/137
1 Like