tvix: strictness bug lib.modules
edition
This is a bug that may or may not be related to the one breaking cross evaluation. Since the amount of Nix code involved in this is less, it is hopefully easier to debug. If it turns out to be the same one, all the better!
When evaluating nixpkgs with tvix (r/6206), you'll notice a lot of warnings related to lib.modules
being printed. This happens due to pkgs/top-level/default.nix
using lib.evalModules
to compute the nixpkgs config
attribute here. As it turns out this already happens when accessing lib.evalModules
:
let lib = import <nixpkgs/lib>; # checked out at 757a0d107c238d031652a8c09d1f6bf1b6f523a3 in lib.modules.evalModules
This prints (in addition to compiler errors) the following warnings:
trace: "warning: External use of `lib.modules.applyModuleArgsIfFunction` is deprecated. If your use case isn't covered by non-deprecated functions, we'd like to know more and perhaps support your use case well, instead of providing access to these low level functions. In this case please open an issue in https://github.com/nixos/nixpkgs/issues/." :: string trace: "warning: External use of `lib.modules.collectModules` is deprecated. If your use case isn't covered by non-deprecated functions, we'd like to know more and perhaps support your use case well, instead of providing access to these low level functions. In this case please open an issue in https://github.com/nixos/nixpkgs/issues/." :: string trace: "warning: External use of `lib.modules.dischargeProperties` is deprecated. If your use case isn't covered by non-deprecated functions, we'd like to know more and perhaps support your use case well, instead of providing access to these low level functions. In this case please open an issue in https://github.com/nixos/nixpkgs/issues/." :: string trace: "warning: External use of `lib.modules.evalOptionValue` is deprecated. If your use case isn't covered by non-deprecated functions, we'd like to know more and perhaps support your use case well, instead of providing access to these low level functions. In this case please open an issue in https://github.com/nixos/nixpkgs/issues/." :: string trace: "warning: External use of `lib.modules.mergeModules` is deprecated. If your use case isn't covered by non-deprecated functions, we'd like to know more and perhaps support your use case well, instead of providing access to these low level functions. In this case please open an issue in https://github.com/nixos/nixpkgs/issues/." :: string trace: "warning: External use of `lib.modules.mergeModules'` is deprecated. If your use case isn't covered by non-deprecated functions, we'd like to know more and perhaps support your use case well, instead of providing access to these low level functions. In this case please open an issue in https://github.com/nixos/nixpkgs/issues/." :: string trace: "warning: External use of `lib.modules.pushDownProperties` is deprecated. If your use case isn't covered by non-deprecated functions, we'd like to know more and perhaps support your use case well, instead of providing access to these low level functions. In this case please open an issue in https://github.com/nixos/nixpkgs/issues/." :: string trace: "warning: External use of `lib.modules.unifyModuleSyntax` is deprecated. If your use case isn't covered by non-deprecated functions, we'd like to know more and perhaps support your use case well, instead of providing access to these low level functions. In this case please open an issue in https://github.com/nixos/nixpkgs/issues/." :: string
It seems that the values of the private
attribute set in lib/modules.nix
are evaluated when they shouldn't be (C++ Nix does not).
And the strictness gremlin is: our implementation of
builtins.mapAttrs
! In good tradition of our early struggles, a strictness bug creeps in via a builtin implementation.tvix-repl> builtins.attrNames (builtins.mapAttrs (builtins.trace) { foo = null; }) trace: "foo" :: string => [ "foo" ] :: list nix-repl> builtins.attrNames (builtins.mapAttrs builtins.trace { foo = null; }) [ "foo" ]
sterni at 2023-05-26T15·40+00
-
sterni at 2023-05-26T19·08+00
b/273 is unaffected by the fix.
sterni at 2023-05-27T09·37+00
- sterni closed this issue at 2023-05-27T09·37+00