Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/release-notes/rl-2511.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@

- Added `gitConfig` and `gitConfigFile` option to the nixpkgs `config`, to allow for setting a default `gitConfigFile` for all `fetchgit` invocations.

- Added options for `allowlistedLicenses` and `blocklistedLicenses` to the nixpkgs `config`. Options for `whitelistedLicenses` and `blacklistedLicenses` were also introduce to avoid changing the behavior of evaluation; these options should not be used because they deprecated and will be removed in a future release.

- The `dockerTools.streamLayeredImage` builder now uses a better algorithm for generating layered docker images, such that much more sharing is possible when the number of store paths exceeds the layer limit. It gives each of the largest store paths its own layer and adds dependencies to those layers when they aren't used elsewhere.

- The systemd initrd will now respect `x-systemd.wants` and `x-systemd.requires` for reliably unlocking multi-disk bcachefs volumes.
Expand Down
24 changes: 22 additions & 2 deletions pkgs/top-level/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ let
literalExpression
mapAttrsToList
mkOption
mkRenamedOptionModuleWith
optionals
types
;
Expand Down Expand Up @@ -235,7 +236,10 @@ let
`allowUnfree` is enabled. It is not a generic allowlist for all types of licenses.
'';
default = [ ];
type = types.listOf (types.attrsOf types.anything);
# NOTE: The type should be `types.listOf (types.attrsOf types.anything)` -- however, this causes infinite
# recursion when `config` is a function because bootstrapping the package set requires evaluating licenses.
# For now, we use types.raw, the same type used by `freeformType`.
Comment on lines +239 to +241
Copy link
Member

Choose a reason for hiding this comment

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

It seems clear to me: the available attributes of pkgs depend on at least config.allowAliases, so pkgs.lib cannot be resolved without considering at least some of config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would make sense for why config.allowAliases cannot depend on pkgs, but that doesn't make sense for licenses (the value of which should not add or remove packages, but determine whether they evaluate).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the wording to be less ambiguous -- thank you @me-and for diving into the call stack in #457120 (comment)!

type = types.raw;
example = literalExpression ''
with lib.licenses; [
amd
Expand All @@ -250,7 +254,10 @@ let
applies to all licenses.
'';
default = [ ];
type = types.listOf (types.attrsOf types.anything);
# NOTE: The type should be `types.listOf (types.attrsOf types.anything)` -- however, this causes infinite
# recursion when `config` is a function because bootstrapping the package set requires evaluating licenses.
# For now, we use types.raw, the same type used by `freeformType`.
type = types.raw;
example = literalExpression ''
with lib.licenses; [
agpl3Only
Expand Down Expand Up @@ -368,6 +375,19 @@ let
in
{

imports = [
(mkRenamedOptionModuleWith {
from = [ "whitelistedLicenses" ];
to = [ "allowlistedLicenses" ];
sinceRelease = 2511;
})
(mkRenamedOptionModuleWith {
from = [ "blacklistedLicenses" ];
to = [ "blocklistedLicenses" ];
sinceRelease = 2511;
})
];

freeformType =
let
t = types.lazyAttrsOf types.raw;
Expand Down
Loading