treewide: use remove
when possible
See https://github.com/nix-community/home-manager/pull/2566.
This commit is contained in:
parent
48f2b381dd
commit
0b197562ab
|
@ -212,7 +212,7 @@ let
|
||||||
# Note: Missing option `D=`.
|
# Note: Missing option `D=`.
|
||||||
transformChannel = channelName:
|
transformChannel = channelName:
|
||||||
let channel = cfg.channels.${channelName};
|
let channel = cfg.channels.${channelName};
|
||||||
in concatStringsSep "\n" (filter (v: v != null) [
|
in concatStringsSep "\n" (remove null [
|
||||||
"" # leave a space between one server and another
|
"" # leave a space between one server and another
|
||||||
(transformField "N" channelName)
|
(transformField "N" channelName)
|
||||||
(loginMethod channel)
|
(loginMethod channel)
|
||||||
|
|
|
@ -180,8 +180,7 @@ in {
|
||||||
"${k} ${if isInt v then toString v else ''"${v}"''}"
|
"${k} ${if isInt v then toString v else ''"${v}"''}"
|
||||||
}";
|
}";
|
||||||
|
|
||||||
settingsStr = concatStringsSep "\n" (filter (x: x != "")
|
settingsStr = concatStringsSep "\n" (remove "" (mapAttrsToList fmtSetting
|
||||||
(mapAttrsToList fmtSetting
|
|
||||||
(builtins.intersectAttrs knownSettings cfg.settings)));
|
(builtins.intersectAttrs knownSettings cfg.settings)));
|
||||||
|
|
||||||
fmtCmdMap = before: k: v:
|
fmtCmdMap = before: k: v:
|
||||||
|
|
|
@ -158,8 +158,8 @@ let
|
||||||
genGroupsChannels = group:
|
genGroupsChannels = group:
|
||||||
concatStringsSep "\n" (genChannelStrings group.name group.channels);
|
concatStringsSep "\n" (genChannelStrings group.name group.channels);
|
||||||
# Generate all channel configurations for all groups for this account.
|
# Generate all channel configurations for all groups for this account.
|
||||||
in concatStringsSep "\n" (filter (s: s != "")
|
in concatStringsSep "\n"
|
||||||
(mapAttrsToList (name: group: genGroupsChannels group) groups));
|
(remove "" (mapAttrsToList (name: group: genGroupsChannels group) groups));
|
||||||
|
|
||||||
# Given the attr set of groups, return a string which maps channels to groups
|
# Given the attr set of groups, return a string which maps channels to groups
|
||||||
genAccountGroups = groups:
|
genAccountGroups = groups:
|
||||||
|
@ -177,9 +177,9 @@ let
|
||||||
# of the groups and its consituent channels.
|
# of the groups and its consituent channels.
|
||||||
genGroupsStrings = mapAttrsToList (name: info:
|
genGroupsStrings = mapAttrsToList (name: info:
|
||||||
concatStringsSep "\n" (genGroupChannelString groups.${name})) groups;
|
concatStringsSep "\n" (genGroupChannelString groups.${name})) groups;
|
||||||
in concatStringsSep "\n\n" (filter (s: s != "")
|
# Join all non-empty groups.
|
||||||
genGroupsStrings) # filter for the cases of empty groups
|
combined = concatStringsSep "\n\n" (remove "" genGroupsStrings) + "\n";
|
||||||
+ "\n"; # Put all strings together.
|
in combined;
|
||||||
|
|
||||||
genGroupConfig = name: channels:
|
genGroupConfig = name: channels:
|
||||||
let
|
let
|
||||||
|
|
|
@ -46,10 +46,10 @@ let
|
||||||
|
|
||||||
moduleConfigure = {
|
moduleConfigure = {
|
||||||
packages.home-manager = {
|
packages.home-manager = {
|
||||||
start = filter (f: f != null) (map
|
start = remove null (map
|
||||||
(x: if x ? plugin && x.optional == true then null else (x.plugin or x))
|
(x: if x ? plugin && x.optional == true then null else (x.plugin or x))
|
||||||
cfg.plugins);
|
cfg.plugins);
|
||||||
opt = filter (f: f != null)
|
opt = remove null
|
||||||
(map (x: if x ? plugin && x.optional == true then x.plugin else null)
|
(map (x: if x ? plugin && x.optional == true then x.plugin else null)
|
||||||
cfg.plugins);
|
cfg.plugins);
|
||||||
};
|
};
|
||||||
|
|
|
@ -136,7 +136,7 @@ in {
|
||||||
|
|
||||||
config = (let
|
config = (let
|
||||||
customRC = ''
|
customRC = ''
|
||||||
${concatStringsSep "\n" (filter (v: v != "") (mapAttrsToList setExpr
|
${concatStringsSep "\n" (remove "" (mapAttrsToList setExpr
|
||||||
(builtins.intersectAttrs knownSettings cfg.settings)))}
|
(builtins.intersectAttrs knownSettings cfg.settings)))}
|
||||||
|
|
||||||
${cfg.extraConfig}
|
${cfg.extraConfig}
|
||||||
|
|
|
@ -5,8 +5,7 @@ with lib;
|
||||||
let
|
let
|
||||||
cfg = config.services.fnott;
|
cfg = config.services.fnott;
|
||||||
|
|
||||||
concatStringsSep' = sep: list:
|
concatStringsSep' = sep: list: concatStringsSep sep (remove "" list);
|
||||||
concatStringsSep sep (filter (x: x != "") list);
|
|
||||||
|
|
||||||
iniFormat = pkgs.formats.ini { };
|
iniFormat = pkgs.formats.ini { };
|
||||||
in {
|
in {
|
||||||
|
|
|
@ -56,12 +56,8 @@ rec {
|
||||||
|
|
||||||
fontConfigStr = let
|
fontConfigStr = let
|
||||||
toFontStr = { names, style ? "", size ? "" }:
|
toFontStr = { names, style ? "", size ? "" }:
|
||||||
optionalString (names != [ ]) concatStringsSep " " (filter (x: x != "") [
|
optionalString (names != [ ]) concatStringsSep " "
|
||||||
"font"
|
(remove "" [ "font" "pango:${concatStringsSep ", " names}" style size ]);
|
||||||
"pango:${concatStringsSep ", " names}"
|
|
||||||
style
|
|
||||||
size
|
|
||||||
]);
|
|
||||||
in fontCfg:
|
in fontCfg:
|
||||||
if isList fontCfg then
|
if isList fontCfg then
|
||||||
toFontStr { names = fontCfg; }
|
toFontStr { names = fontCfg; }
|
||||||
|
|
Loading…
Reference in a new issue