mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-05 17:27:50 +00:00
fix(lint): nixfmt the whole tree
This commit is contained in:
parent
643b136863
commit
bf219a30c2
69 changed files with 2605 additions and 1726 deletions
|
|
@ -1,22 +1,37 @@
|
|||
{ lib, myLib }:
|
||||
with lib;
|
||||
rec {
|
||||
toPretty = depth: x:
|
||||
toPretty =
|
||||
depth: x:
|
||||
# Stolen from: https://github.com/teto/nixpkgs/blob/6f098631f6f06b93c17f49abdf677790e017778d/lib/debug.nix#L109C5-L117C30
|
||||
let
|
||||
snip = v: if isList v then noQuotes "[…]" v
|
||||
else if isAttrs v then noQuotes "{…}" v
|
||||
else v;
|
||||
noQuotes = str: v: { __pretty = const str; val = v; };
|
||||
modify = n: fn: v: if (n == 0) then fn v
|
||||
else if isList v then map (modify (n - 1) fn) v
|
||||
else if isAttrs v then mapAttrs
|
||||
(const (modify (n - 1) fn)) v
|
||||
else v;
|
||||
in lib.generators.toPretty { allowPrettyValues = true; } (modify depth snip x);
|
||||
|
||||
traceValWithPrefix = prefix: value:
|
||||
snip =
|
||||
v:
|
||||
if isList v then
|
||||
noQuotes "[…]" v
|
||||
else if isAttrs v then
|
||||
noQuotes "{…}" v
|
||||
else
|
||||
v;
|
||||
noQuotes = str: v: {
|
||||
__pretty = const str;
|
||||
val = v;
|
||||
};
|
||||
modify =
|
||||
n: fn: v:
|
||||
if (n == 0) then
|
||||
fn v
|
||||
else if isList v then
|
||||
map (modify (n - 1) fn) v
|
||||
else if isAttrs v then
|
||||
mapAttrs (const (modify (n - 1) fn)) v
|
||||
else
|
||||
v;
|
||||
in
|
||||
lib.generators.toPretty { allowPrettyValues = true; } (modify depth snip x);
|
||||
|
||||
traceValWithPrefix =
|
||||
prefix: value:
|
||||
#trace "traceValWithPrefix 'prefix': ${prefix}" value
|
||||
trace "${prefix}: ${toPretty 2 value}" value
|
||||
;
|
||||
trace "${prefix}: ${toPretty 2 value}" value;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue