mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 04:43:09 +03:00
Replace some calls to attrByPath with "or"
This commit is contained in:
parent
c68c95d55a
commit
0b4fb4e4f6
@ -44,9 +44,9 @@ rec {
|
|||||||
delayedModule = delayProperties m;
|
delayedModule = delayProperties m;
|
||||||
getImports =
|
getImports =
|
||||||
if m ? config || m ? options then
|
if m ? config || m ? options then
|
||||||
attrByPath ["imports"] [] m
|
m.imports or []
|
||||||
else
|
else
|
||||||
toList (rmProperties (attrByPath ["require"] [] delayedModule));
|
toList (rmProperties (delayedModule.require or []));
|
||||||
|
|
||||||
getImportedPaths = filter isPath getImports;
|
getImportedPaths = filter isPath getImports;
|
||||||
getImportedSets = filter (x: !isPath x) getImports;
|
getImportedSets = filter (x: !isPath x) getImports;
|
||||||
@ -92,7 +92,7 @@ rec {
|
|||||||
else newModuleName origin index;
|
else newModuleName origin index;
|
||||||
};
|
};
|
||||||
|
|
||||||
getImports = m: attrByPath ["imports"] [] m;
|
getImports = m: m.imports or [];
|
||||||
|
|
||||||
newModuleName = origin: index:
|
newModuleName = origin: index:
|
||||||
"${origin.key}:<import-${toString index}>";
|
"${origin.key}:<import-${toString index}>";
|
||||||
@ -110,8 +110,8 @@ rec {
|
|||||||
selectDeclsAndDefs = modules:
|
selectDeclsAndDefs = modules:
|
||||||
lib.concatMap (m:
|
lib.concatMap (m:
|
||||||
if m ? config || m ? options then
|
if m ? config || m ? options then
|
||||||
[ (attrByPath ["options"] {} m) ]
|
[ (m.options or {}) ]
|
||||||
++ [ (attrByPath ["config"] {} m) ]
|
++ [ (m.config or {}) ]
|
||||||
else
|
else
|
||||||
[ m ]
|
[ m ]
|
||||||
) modules;
|
) modules;
|
||||||
|
@ -152,13 +152,11 @@ rec {
|
|||||||
opt1 // opt2
|
opt1 // opt2
|
||||||
// optionalAttrs (opt1 ? options || opt2 ? options) {
|
// optionalAttrs (opt1 ? options || opt2 ? options) {
|
||||||
options =
|
options =
|
||||||
(toList (attrByPath ["options"] [] opt1))
|
(toList (opt1.options or []))
|
||||||
++ (toList (attrByPath ["options"] [] opt2));
|
++ (toList (opt2.options or []));
|
||||||
}
|
}
|
||||||
// optionalAttrs (opt1 ? extraConfigs || opt2 ? extraConfigs) {
|
// optionalAttrs (opt1 ? extraConfigs || opt2 ? extraConfigs) {
|
||||||
extraConfigs =
|
extraConfigs = opt1.extraConfigs or [] ++ opt2.extraConfigs or [];
|
||||||
(attrByPath ["extraConfigs"] [] opt1)
|
|
||||||
++ (attrByPath ["extraConfigs"] [] opt2);
|
|
||||||
}
|
}
|
||||||
)) {} opts;
|
)) {} opts;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user