Skip to content

lib/types: types deprecate functor.wrapped in favor of functor.payload.elemType for trivial cases#375084

Merged
infinisil merged 4 commits intoNixOS:masterfrom
hsjobeki:types/unique
Mar 20, 2025
Merged

lib/types: types deprecate functor.wrapped in favor of functor.payload.elemType for trivial cases#375084
infinisil merged 4 commits intoNixOS:masterfrom
hsjobeki:types/unique

Conversation

@hsjobeki
Copy link
Contributor

@hsjobeki hsjobeki commented Jan 19, 2025

  • As part of removing functor.wrapped in the long term. This PR deprecates it for some trivial cases
  • Added release notes

The following types now use functor.payload.elemType acessing functor.wrapped will from now on show a warning.

  • lib.types.unique and lib.types.uniq
  • lib.types.nullOr
  • lib.types.functionTo
  • lib.types.coercedTo

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@hsjobeki hsjobeki requested a review from infinisil January 19, 2025 15:17
@github-actions github-actions bot added 8.has: documentation This PR adds or changes documentation 6.topic: module system About "NixOS" module system internals 6.topic: lib The Nixpkgs function library labels Jan 19, 2025
@nix-owners nix-owners bot requested a review from roberth January 19, 2025 15:18
@github-actions github-actions bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Jan 19, 2025
@hsjobeki hsjobeki changed the title lib/types: types.{unique,uniq} deprecate functor.wrapped in favor of functor.payload.elemType lib/types: types deprecate functor.wrapped in favor of functor.payload.elemType for trivial cases Jan 19, 2025
Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(reviewed together in a meeting) This is good with a bit more testing, see #382856

@github-actions github-actions bot added the 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. label Mar 14, 2025
Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed together, looking good!

@infinisil infinisil merged commit 987a096 into NixOS:master Mar 20, 2025
37 checks passed
alfarelcynthesis added a commit to alfarelcynthesis/nvf that referenced this pull request Sep 27, 2025
This is the more modern approach: NixOS/nixpkgs#375084
The above PR does this for similar cases in nixpkgs.

This fixes a warning that shows up when using the lib in weird ways:

```
trace: evaluation warning: The deprecated `functor.wrapped` attribute is accessed, use `nestedTypes.elemType` instead.
```

The warning is thrown by the module system when merging types
(at least in some cases).
It shouldn't be exposed at all in the current codebase.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: lib The Nixpkgs function library 6.topic: module system About "NixOS" module system internals 8.has: documentation This PR adds or changes documentation 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants