git.iko.soy/typeable/nixpkgs
on master help sign in
lib: add `showWarnings`
commit570aed4b46916551da969c4daeef0322461ac2fe authorJan Malakhovski <oxij@oxij.org> dateSat 23 Feb 2019, 18:06 (8 years ago) parente84cf5e
3 files changed+4−5
lib/default.nix+1−1 lib/trivial.nix+2−1 nixos/modules/system/activation/top-level.nix+1−3
lib/default.nix+1−1
@@ -59,7 +59,7 @@ let
5959 stringLength sub substring tail;
6060 inherit (trivial) id const concat or and bitAnd bitOr bitXor bitNot
6161 boolToString mergeAttrs flip mapNullable inNixShell min max
62− importJSON warn info nixpkgsVersion version mod compare
62+ importJSON warn info showWarnings nixpkgsVersion version mod compare
6363 splitByAndCompare functionArgs setFunctionArgs isFunction;
6464 inherit (fixedPoints) fix fix' converge extends composeExtensions
6565 makeExtensible makeExtensibleWithCustomName;
lib/trivial.nix+2−1
@@ -259,9 +259,10 @@ rec {
259259 # TODO: figure out a clever way to integrate location information from
260260 # something like __unsafeGetAttrPos.
261261
262− warn = msg: builtins.trace "WARNING: ${msg}";
262+ warn = msg: builtins.trace "warning: ${msg}";
263263 info = msg: builtins.trace "INFO: ${msg}";
264264
265+ showWarnings = warnings: res: lib.fold (w: x: warn w x) res warnings;
265266
266267 ## Function annotations
267268
nixos/modules/system/activation/top-level.nix+1−3
@@ -130,11 +130,9 @@ let
130130
131131 failedAssertions = map (x: x.message) (filter (x: !x.assertion) config.assertions);
132132
133− showWarnings = res: fold (w: x: builtins.trace "warning: ${w}" x) res config.warnings;
134−
135133 baseSystemAssertWarn = if failedAssertions != []
136134 then throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}"
137− else showWarnings baseSystem;
135+ else showWarnings config.warnings baseSystem;
138136
139137 # Replace runtime dependencies
140138 system = fold ({ oldDependency, newDependency }: drv: