Skip to content

treewide: use lib.extendDerivation' instead of lib.extendDerivation where appropriate#271213

Draft
ShamrockLee wants to merge 4 commits intoNixOS:masterfrom
ShamrockLee:use-extend-derivation-fix
Draft

treewide: use lib.extendDerivation' instead of lib.extendDerivation where appropriate#271213
ShamrockLee wants to merge 4 commits intoNixOS:masterfrom
ShamrockLee:use-extend-derivation-fix

Conversation

@ShamrockLee
Copy link
Contributor

Description of changes

Fix overriding issues caused by lib.extendDerivation with lib.extendDerivation'. lib.extendDerivaiton is designed for low-level usage and assume that there's no existing attributes that performs overriding (e.g. <pkgs>.overrideAttrs) in the derivation it updates.

Split from #269785
Depends on #269785

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/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 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.

Priorities

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: kernel The Linux kernel 8.has: documentation This PR adds or changes documentation 8.has: changelog This PR adds or changes release notes 6.topic: lib The Nixpkgs function library labels Nov 30, 2023
@ShamrockLee ShamrockLee force-pushed the use-extend-derivation-fix branch from 545bef2 to a0bbb89 Compare November 30, 2023 15:20
@github-actions github-actions bot removed the 6.topic: python Python is a high-level, general-purpose programming language. label Nov 30, 2023
@ofborg ofborg bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 30, 2023
ShamrockLee and others added 4 commits December 1, 2023 16:58
Add lib.extendDerivaton' as an overriding-aware alternative to
`lib.extendDerivation`.

Co-authored-by: Harsh Shandilya <[email protected]>
Preserve the attributes update across overriding using
`lib.extendDerivaiton'`,
instead of plain `lib.extendDerivation`.

Take the Linux kernel package as an example:

```nix
pkgs.linuxPackages.kernel.features
=> { efiBootStub = true; ia32Emulation = true; iwlwifi = true; needsCifsUtils = true; netfilterRPFilter = true; }

\# Before
(pkgs.linuxPackages.kernel.overrideAttrs { }).features
=> error: attribute 'features' missing

\# After
(pkgs.linuxPackages.kernel.overrideAttrs { }).features
=> { efiBootStub = true; ia32Emulation = true; iwlwifi = true; needsCifsUtils = true; netfilterRPFilter = true; }
```
@ShamrockLee ShamrockLee force-pushed the use-extend-derivation-fix branch from a0bbb89 to 61526cd Compare December 1, 2023 09:29
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. and removed 2.status: merge conflict This PR has merge conflicts with the target branch labels Dec 1, 2023
@ShamrockLee ShamrockLee changed the title treewide: use lib.extendDerivation' instead of lib.extendDerivaiton where appropriate treewide: use lib.extendDerivation' instead of lib.extendDerivation where appropriate Feb 11, 2024
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 20, 2024
@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: kernel The Linux kernel 6.topic: lib The Nixpkgs function library 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation 10.rebuild-darwin: 0 This PR does not cause any packages 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