···12 version
13 versionSuffix
14 warn;
00015in {
1617 ## Simple (higher order) functions
···718 importTOML = path:
719 builtins.fromTOML (builtins.readFile path);
720721- ## Warnings
722723- # See https://github.com/NixOS/nix/issues/749. Eventually we'd like these
724- # to expand to Nix builtins that carry metadata so that Nix can filter out
725- # the INFO messages without parsing the message string.
726- #
727- # Usage:
728- # {
729- # foo = lib.warn "foo is deprecated" oldFoo;
730- # bar = lib.warnIf (bar == "") "Empty bar is deprecated" bar;
731- # }
732- #
733- # TODO: figure out a clever way to integrate location information from
734- # something like __unsafeGetAttrPos.
735736- /**
737- Print a warning before returning the second argument. This function behaves
738- like `builtins.trace`, but requires a string message and formats it as a
739- warning, including the `warning: ` prefix.
740741- To get a call stack trace and abort evaluation, set the environment variable
742- `NIX_ABORT_ON_WARN=true` and set the Nix options `--option pure-eval false --show-trace`
743744 # Inputs
745746- `msg`
747748- : Warning message to print.
749750- `val`
751752 : Value to return as-is.
753754 # Type
755756 ```
757- string -> a -> a
758 ```
759 */
760 warn =
761- if lib.elem (builtins.getEnv "NIX_ABORT_ON_WARN") ["1" "true" "yes"]
762- then msg: builtins.trace "[1;31mwarning: ${msg}[0m" (abort "NIX_ABORT_ON_WARN=true; warnings are treated as unrecoverable errors.")
763- else msg: builtins.trace "[1;31mwarning: ${msg}[0m";
000000000764765 /**
766- Like warn, but only warn when the first argument is `true`.
767000768769 # Inputs
770771- `cond`
772773- : 1\. Function argument
774775- `msg`
776777- : 2\. Function argument
778779- `val`
780781 : Value to return as-is.
782783 # Type
784785 ```
786- bool -> string -> a -> a
787 ```
788 */
789 warnIf = cond: msg: if cond then warn msg else x: x;
790791 /**
792- Like warnIf, but negated (warn if the first argument is `false`).
793000794795 # Inputs
796797- `cond`
798799- : 1\. Function argument
800801- `msg`
802803- : 2\. Function argument
804805- `val`
806807 : Value to return as-is.
808809 # Type
810811 ```
812- bool -> string -> a -> a
813 ```
814 */
815 warnIfNot = cond: msg: if cond then x: x else warn msg;
···12 version
13 versionSuffix
14 warn;
15+ inherit (lib)
16+ isString
17+ ;
18in {
1920 ## Simple (higher order) functions
···721 importTOML = path:
722 builtins.fromTOML (builtins.readFile path);
723724+ /**
725726+ `warn` *`message`* *`value`*
00000000000727728+ Print a warning before returning the second argument.
000729730+ See [`builtins.warn`](https://nix.dev/manual/nix/latest/language/builtins.html#builtins-warn) (Nix >= 2.23).
731+ On older versions, the Nix 2.23 behavior is emulated with [`builtins.trace`](https://nix.dev/manual/nix/latest/language/builtins.html#builtins-warn), including the [`NIX_ABORT_ON_WARN`](https://nix.dev/manual/nix/latest/command-ref/conf-file#conf-abort-on-warn) behavior, but not the `nix.conf` setting or command line option.
732733 # Inputs
734735+ *`message`* (String)
736737+ : Warning message to print before evaluating *`value`*.
738739+ *`value`* (any value)
740741 : Value to return as-is.
742743 # Type
744745 ```
746+ String -> a -> a
747 ```
748 */
749 warn =
750+ # Since Nix 2.23, https://github.com/NixOS/nix/pull/10592
751+ builtins.warn or (
752+ let mustAbort = lib.elem (builtins.getEnv "NIX_ABORT_ON_WARN") ["1" "true" "yes"];
753+ in
754+ # Do not eta reduce v, so that we have the same strictness as `builtins.warn`.
755+ msg: v:
756+ # `builtins.warn` requires a string message, so we enforce that in our implementation, so that callers aren't accidentally incompatible with newer Nix versions.
757+ assert isString msg;
758+ if mustAbort
759+ then builtins.trace "[1;31mevaluation warning:[0m ${msg}" (abort "NIX_ABORT_ON_WARN=true; warnings are treated as unrecoverable errors.")
760+ else builtins.trace "[1;35mevaluation warning:[0m ${msg}" v
761+ );
762763 /**
0764765+ `warnIf` *`condition`* *`message`* *`value`*
766+767+ Like `warn`, but only warn when the first argument is `true`.
768769 # Inputs
770771+ *`condition`* (Boolean)
772773+ : `true` to trigger the warning before continuing with *`value`*.
774775+ *`message`* (String)
776777+ : Warning message to print before evaluating
778779+ *`value`* (any value)
780781 : Value to return as-is.
782783 # Type
784785 ```
786+ Bool -> String -> a -> a
787 ```
788 */
789 warnIf = cond: msg: if cond then warn msg else x: x;
790791 /**
0792793+ `warnIfNot` *`condition`* *`message`* *`value`*
794+795+ Like `warnIf`, but negated: warn if the first argument is `false`.
796797 # Inputs
798799+ *`condition`*
800801+ : `false` to trigger the warning before continuing with `val`.
802803+ *`message`*
804805+ : Warning message to print before evaluating *`value`*.
806807+ *`value`*
808809 : Value to return as-is.
810811 # Type
812813 ```
814+ Boolean -> String -> a -> a
815 ```
816 */
817 warnIfNot = cond: msg: if cond then x: x else warn msg;
+2
nixos/doc/manual/release-notes/rl-2411.section.md
···5657- [Apache Tika](https://github.com/apache/tika), a toolkit that detects and extracts metadata and text from over a thousand different file types. Available as [services.tika](option.html#opt-services.tika).
580059## Backward Incompatibilities {#sec-release-24.11-incompatibilities}
6061- `transmission` package has been aliased with a `trace` warning to `transmission_3`. Since [Transmission 4 has been released last year](https://github.com/transmission/transmission/releases/tag/4.0.0), and Transmission 3 will eventually go away, it was decided perform this warning alias to make people aware of the new version. The `services.transmission.package` defaults to `transmission_3` as well because the upgrade can cause data loss in certain specific usage patterns (examples: [#5153](https://github.com/transmission/transmission/issues/5153), [#6796](https://github.com/transmission/transmission/issues/6796)). Please make sure to back up to your data directory per your usage:
···5657- [Apache Tika](https://github.com/apache/tika), a toolkit that detects and extracts metadata and text from over a thousand different file types. Available as [services.tika](option.html#opt-services.tika).
5859+- [Improved File Manager](https://github.com/misterunknown/ifm), or IFM, a single-file web-based file manager.
60+61## Backward Incompatibilities {#sec-release-24.11-incompatibilities}
6263- `transmission` package has been aliased with a `trace` warning to `transmission_3`. Since [Transmission 4 has been released last year](https://github.com/transmission/transmission/releases/tag/4.0.0), and Transmission 3 will eventually go away, it was decided perform this warning alias to make people aware of the new version. The `services.transmission.package` defaults to `transmission_3` as well because the upgrade can cause data loss in certain specific usage patterns (examples: [#5153](https://github.com/transmission/transmission/issues/5153), [#6796](https://github.com/transmission/transmission/issues/6796)). Please make sure to back up to your data directory per your usage:
···86 '';
87 };
8889- disabledTests = lib.optionals stdenv.isDarwin [
000090 # Langchain-core the following tests due to the test comparing execution time with magic values.
91 "test_queue_for_streaming_via_sync_call"
92 "test_same_event_loop"
···86 '';
87 };
8889+ disabledTests = [
90+ # flaky, sometimes fail to strip uuid from AIMessageChunk before comparing to test value
91+ "test_map_stream"
92+ ]
93+ ++ lib.optionals stdenv.isDarwin [
94 # Langchain-core the following tests due to the test comparing execution time with magic values.
95 "test_queue_for_streaming_via_sync_call"
96 "test_same_event_loop"