move function to utils
This commit is contained in:
parent
414d80d105
commit
8d63d72b2d
2 changed files with 3 additions and 13 deletions
|
@ -17,7 +17,7 @@ with lib.lists;
|
||||||
with lib.strings;
|
with lib.strings;
|
||||||
let
|
let
|
||||||
|
|
||||||
configcreator = pkgs.callPackage ./configcreator.nix {};
|
configcreator = pkgs.callPackage ./configcreator.nix {inherit utils;};
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{ lib
|
{ lib
|
||||||
, pkgs
|
, pkgs
|
||||||
|
, utils
|
||||||
}:
|
}:
|
||||||
|
|
||||||
with builtins;
|
with builtins;
|
||||||
|
@ -7,6 +8,7 @@ with lib;
|
||||||
with lib.attrsets;
|
with lib.attrsets;
|
||||||
with lib.lists;
|
with lib.lists;
|
||||||
with lib.strings;
|
with lib.strings;
|
||||||
|
with utils;
|
||||||
let
|
let
|
||||||
getAttrWithDefault = name: default: attrset:
|
getAttrWithDefault = name: default: attrset:
|
||||||
if isAttrs attrset && hasAttr name attrset then
|
if isAttrs attrset && hasAttr name attrset then
|
||||||
|
@ -283,18 +285,6 @@ let
|
||||||
concatStringsRecursive = sep: strings:
|
concatStringsRecursive = sep: strings:
|
||||||
concatStringsSep sep (flatten strings);
|
concatStringsSep sep (flatten strings);
|
||||||
|
|
||||||
recursiveMerge = attrList:
|
|
||||||
let f = attrPath:
|
|
||||||
zipAttrsWith (n: values:
|
|
||||||
if all isList values then
|
|
||||||
concatLists values
|
|
||||||
else if all isAttrs values then
|
|
||||||
f (attrPath ++ [n]) values
|
|
||||||
else
|
|
||||||
last values
|
|
||||||
);
|
|
||||||
in f [] attrList;
|
|
||||||
|
|
||||||
assertHasAttr = name: attrPath: v:
|
assertHasAttr = name: attrPath: v:
|
||||||
assertMsg
|
assertMsg
|
||||||
(hasAttrByPath attrPath v)
|
(hasAttrByPath attrPath v)
|
||||||
|
|
Loading…
Reference in a new issue