-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Move printing of warnings out of nix-evaluation #23592
WIP: Move printing of warnings out of nix-evaluation #23592
Conversation
Warnings generated by the module system are currently printed to stdout during nix-instantiate. The problem with this is that nix-build typically generates quite a lot of output, and the end user might miss the warnings that are generated by nix. To make these warnings more visible, this commit gathers the warnings, writes them to $out/warnings.json and $out/warnings.txt.raw. $out/warnings.json will be machine readable; therefore it could be used in e.g. nixops directly. $out/warnings.txt.raw contains a stream that can be send to stderr directly to print the warnings as they would have been printed by `builtins.trace` in the nix-instantiate phase. TODO: - Add a `--skip-module-warnings` flag to `switch-to-configuration.pl` to skip printing the warnings. - Make nixos-build print this message, then run the activation script with `--skip-module-warnings`. - Create a PR for NixOps to list warnings for machines. DISCUSSION POINTS - Make it this configureable using an env variable. Some people might prefer to have the warnings up front, before nix-build happens.
@moretea, thanks for your PR! By analyzing the history of the files in this pull request, we identified @vcunat, @edolstra and @lethalman to be potential reviewers. |
I wonder about integrating these warnings in to the motd as well, but not sure. :) I'm liking the direction. |
@grahamc interesting suggestion. I checked that PAM is not tripped if this file is missing, so this would be pretty safe to use. Should we spam all users with this message? |
Well, if you want to spam only one user, you can just add a line into shell profile… |
I like this in principle, and I like the implementation, but I use mainline NixOS too little to be willing to merge. |
@7c6f434c, if you'd add it to the shell profile, it would print out a message every time you'd start a new interactive shell, right? I think that is a little too much. |
There is RC and there is profile; in most configurations profile is used
only for new «login shells», and a random rxvt instance is not a login
shell.
Of course, with systemd having broken startx beyond repair, in NixOS you
realistically have a login shell only either via SSH or on an X-less
computer.
|
My reluctance to merge is more about this being in a part of NixOS I am not going to use in my mix-and-match Nix-based system. I was just commenting on the space of natural options. |
Any update on this pull request? |
Closing due to lack of activity, feel free to reopen this if needed. |
Second part of #22096 (comment)
Motivation for this change
Warnings generated by the module system are currently printed to stdout during nix-instantiate. The problem with this is that nix-build typically generates quite a lot of output, and the end user might miss
the warnings that are generated by nix.
To make these warnings more visible, this PR proposes to gather the warnings, and write them to
$out/warnings.json
and$out/warnings.txt.raw
. Note that$out
in this context "is a"/run/current-system
$out/warnings.json
will be machine readable; therefore it could be used in e.g. nixops directly.$out/warnings.txt.raw
contains a stream that can be send to stderr directly to print the warnings as they would have been printed bybuiltins.trace
in the nix-instantiate phase.TODO
--skip-module-warnings
flag toswitch-to-configuration.pl
to skip printing thewarnings.
with
--skip-module-warnings
.DISCUSSION POINTS
Some people might prefer to have the warnings up front, before
nix-build happens.