Merge remote-tracking branch 'upstream/nixos-25.05' into nixos-25.05

This commit is contained in:
2025-05-18 18:14:19 +08:00
2818 changed files with 70643 additions and 50258 deletions

View File

@@ -1,5 +1,16 @@
{ lib }:
let
inherit (lib.strings)
concatStringsSep
;
inherit (lib.lists)
filter
;
inherit (lib.trivial)
showWarnings
;
in
rec {
/**
@@ -131,4 +142,61 @@ rec {
"each element in ${name} must be one of ${lib.generators.toPretty { } xs}, but is: ${
lib.generators.toPretty { } vals
}";
/**
Wrap a value with logic that throws an error when assertions
fail and emits any warnings.
# Inputs
`assertions`
: A list of assertions. If any of their `assertion` attrs is `false`, their `message` attrs will be emitted in a `throw`.
`warnings`
: A list of strings to emit as warnings. This function does no filtering on this list.
`val`
: A value to return, wrapped in `warn`, if a `throw` is not necessary.
# Type
```
checkAssertWarn :: [ { assertion :: Bool; message :: String } ] -> [ String ] -> Any -> Any
```
# Examples
:::{.example}
## `lib.asserts.checkAssertWarn` usage example
```nix
checkAssertWarn
[ { assertion = false; message = "Will fail"; } ]
[ ]
null
stderr> error:
stderr> Failed assertions:
stderr> - Will fail
checkAssertWarn
[ { assertion = true; message = "Will not fail"; } ]
[ "Will warn" ]
null
stderr> evaluation warning: Will warn
null
```
:::
*/
checkAssertWarn =
assertions: warnings: val:
let
failedAssertions = map (x: x.message) (filter (x: !x.assertion) assertions);
in
if failedAssertions != [ ] then
throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}"
else
showWarnings warnings val;
}

View File

@@ -1042,7 +1042,7 @@ rec {
:::
*/
mapAttrs' = f: set: listToAttrs (map (attr: f attr set.${attr}) (attrNames set));
mapAttrs' = f: set: listToAttrs (mapAttrsToList f set);
/**
Call a function for each attribute in the given set and return
@@ -1076,7 +1076,7 @@ rec {
:::
*/
mapAttrsToList = f: attrs: map (name: f name attrs.${name}) (attrNames attrs);
mapAttrsToList = f: attrs: attrValues (mapAttrs f attrs);
/**
Deconstruct an attrset to a list of name-value pairs as expected by [`builtins.listToAttrs`](https://nixos.org/manual/nix/stable/language/builtins.html#builtins-listToAttrs).

View File

@@ -651,6 +651,11 @@ lib.mapAttrs mkLicense (
url = "https://fedoraproject.org/wiki/Licensing/GPL_Classpath_Exception";
};
gpl2UBDLPlus = {
fullName = "GNU General Public License v3.0 or later (with UBDL exception)";
url = "https://spdx.org/licenses/UBDL-exception.html";
};
gpl2Oss = {
fullName = "GNU General Public License version 2 only (with OSI approved licenses linking exception)";
url = "https://www.mysql.com/about/legal/licensing/foss-exception";

View File

@@ -1881,7 +1881,7 @@ let
This function does not add support for deduplication and `disabledModules`,
although that could be achieved by wrapping the returned module and setting
the `_key` module attribute.
the `key` module attribute.
The reason for this omission is that the file path is not guaranteed to be
a unique identifier for the module, as two instances of the module may
reference different `arg`s in their closures.

View File

@@ -382,7 +382,7 @@ in
(splitRoot p).root
(splitRoot p).subpath
- Trying to get the parent directory of `root` using [`readDir`](https://nixos.org/manual/nix/stable/language/builtins.html#builtins-readDir) returns `root` itself:
- Trying to get the parent directory of `root` using [`dirOf`](https://nixos.org/manual/nix/stable/language/builtins.html#builtins-dirOf) returns `root` itself:
dirOf (splitRoot p).root == (splitRoot p).root

View File

@@ -352,21 +352,9 @@ let
else
null;
# Remove before 25.05
androidSdkVersion =
if (args ? sdkVer && !args ? androidSdkVersion) then
throw "For android `sdkVer` has been renamed to `androidSdkVersion`"
else if (args ? androidSdkVersion) then
args.androidSdkVersion
else
null;
androidNdkVersion =
if (args ? ndkVer && !args ? androidNdkVersion) then
throw "For android `ndkVer` has been renamed to `androidNdkVersion`"
else if (args ? androidSdkVersion) then
args.androidNdkVersion
else
null;
# Handle Android SDK and NDK versions.
androidSdkVersion = args.androidSdkVersion or null;
androidNdkVersion = args.androidNdkVersion or null;
}
// (
let

View File

@@ -146,6 +146,10 @@ rec {
riscv64 = riscv "64";
riscv32 = riscv "32";
riscv64-musl = {
config = "riscv64-unknown-linux-musl";
};
riscv64-embedded = {
config = "riscv64-none-elf";
libc = "newlib";