treewide: use use lib.optionalAttrs instead of 'then {}'
This commit is contained in:
parent
f47f0a525c
commit
ed3b102d1e
5 changed files with 5 additions and 9 deletions
|
@ -11,7 +11,7 @@ let
|
|||
default = null;
|
||||
description = lib.mdDoc description;
|
||||
type = types.nullOr types.lines;
|
||||
} // (if example == null then {} else { inherit example; });
|
||||
} // (lib.optionalAttrs (example != null) { inherit example; });
|
||||
};
|
||||
mkHookOptions = hooks: listToAttrs (map mkHookOption hooks);
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ let
|
|||
text = v.extraConfig;
|
||||
})
|
||||
(filterAttrs (n: v: v.extraConfig != "") cfg.workers))
|
||||
// (if cfg.extraConfig == "" then {} else {
|
||||
// (lib.optionalAttrs (cfg.extraConfig != "") {
|
||||
"extra-config.inc".text = cfg.extraConfig;
|
||||
});
|
||||
in
|
||||
|
|
|
@ -86,8 +86,7 @@ let
|
|||
mattermostConf = recursiveUpdate
|
||||
mattermostConfWithoutPlugins
|
||||
(
|
||||
if mattermostPlugins == null then {}
|
||||
else {
|
||||
lib.optionalAttrs (mattermostPlugins != null) {
|
||||
PluginSettings = {
|
||||
Enable = true;
|
||||
};
|
||||
|
|
|
@ -23,9 +23,7 @@
|
|||
maintainers = [ maintainers.vbgl ];
|
||||
};
|
||||
}).overrideAttrs (x:
|
||||
if lib.versionAtLeast x.version "20210316"
|
||||
then {}
|
||||
else {
|
||||
lib.optionalAttrs (lib.versionOlder x.version "20210316") {
|
||||
installFlags = [ "CONTRIB=$(out)/lib/coq/${coq.coq-version}/user-contrib" ];
|
||||
}
|
||||
)
|
||||
|
|
|
@ -4,8 +4,7 @@ let
|
|||
skipBuildPhase = x: {
|
||||
overrides = y: ((x.overrides y) // { buildPhase = "true"; });
|
||||
};
|
||||
multiOverride = l: x: if l == [] then {} else
|
||||
((builtins.head l) x) // (multiOverride (builtins.tail l) x);
|
||||
multiOverride = l: x: pkgs.lib.optionalAttrs (l != []) ((builtins.head l) x) // (multiOverride (builtins.tail l) x);
|
||||
lispName = (clwrapper.lisp.pname or (builtins.parseDrvName clwrapper.lisp.name).name);
|
||||
ifLispIn = l: f: if (pkgs.lib.elem lispName l) then f else (x: {});
|
||||
ifLispNotIn = l: f: if ! (pkgs.lib.elem lispName l) then f else (x: {});
|
||||
|
|
Loading…
Reference in a new issue