mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2025-01-05 20:11:43 +03:00
Merge pull request #235924 from Stunkymonkey/remove-then-{}
treewide: use lib.optionalAttrs instead of 'then {}'
This commit is contained in:
commit
7907dd9d6b
@ -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 New Issue
Block a user