nixpkgs: pass lib to config function (#457120)
This commit is contained in:
@@ -9,6 +9,32 @@
|
||||
- Node.js default version has been updated from 22 LTS to 24 LTS.
|
||||
This introduces some breaking changes; Refer to the [upstream migration article](https://nodejs.org/en/blog/migrations/v22-to-v24) for details.
|
||||
|
||||
- Nixpkgs configuration, specified for NixOS using `nixpkgs.config`, or using the `config` argument when importing nixpkgs, has learned to accept a `lib` argument as well as `pkgs`, which allows the configuration to be computed without depending on the `pkgs` fixed point. If you are referencing licenses in `lib.licenses` by having this configuration be a function taking a `pkgs` arg, you may wish to change to using `lib` for faster computation and to avoid infinite recursion errors if pkgs depends on parts of the computed configuration in future.
|
||||
|
||||
For example, if you currently have configuration that looks like this:
|
||||
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
allowlistedLicenses = [ pkgs.lib.licenses.nasa13 ];
|
||||
blocklistedLicenses = with pkgs.lib.licenses; [ gpl3Only gpl3Plus ];
|
||||
}
|
||||
|
||||
You may wish to update it to something like this:
|
||||
|
||||
{ lib, ... }:
|
||||
{
|
||||
allowlistedLicenses = [ lib.licenses.nasa13 ];
|
||||
blocklistedLicenses = with lib.licenses; [ gpl3Only gpl3Plus ];
|
||||
}
|
||||
|
||||
Or, if you need configuration that works with both 26.05 and 25.11:
|
||||
|
||||
{ pkgs, lib ? pkgs.lib, ... }:
|
||||
{
|
||||
allowlistedLicenses = [ lib.licenses.nasa13 ];
|
||||
blocklistedLicenses = with lib.licenses; [ gpl3Only gpl3Plus ];
|
||||
}
|
||||
|
||||
## Backward Incompatibilities {#sec-nixpkgs-release-26.05-incompatibilities}
|
||||
|
||||
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
||||
|
||||
@@ -16,8 +16,8 @@ let
|
||||
mergeConfig =
|
||||
lhs_: rhs_:
|
||||
let
|
||||
lhs = optCall lhs_ { inherit pkgs; };
|
||||
rhs = optCall rhs_ { inherit pkgs; };
|
||||
lhs = optCall lhs_ { inherit lib pkgs; };
|
||||
rhs = optCall rhs_ { inherit lib pkgs; };
|
||||
in
|
||||
lib.recursiveUpdate lhs rhs
|
||||
// lib.optionalAttrs (lhs ? packageOverrides) {
|
||||
|
||||
@@ -109,7 +109,7 @@ let
|
||||
# Allow both:
|
||||
# { /* the config */ } and
|
||||
# { pkgs, ... } : { /* the config */ }
|
||||
config1 = if lib.isFunction config0 then config0 { inherit pkgs; } else config0;
|
||||
config1 = if lib.isFunction config0 then config0 { inherit lib pkgs; } else config0;
|
||||
|
||||
configEval = lib.evalModules {
|
||||
modules = [
|
||||
|
||||
Reference in New Issue
Block a user