mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
statix: enable eta_reduction
Enable statix's eta_reduction rule and apply its auto-fixes across the affected modules.
This commit is contained in:
@@ -107,7 +107,7 @@ rec {
|
||||
sameOrNull = x: y: if x == y then y else null;
|
||||
# A bit naive to just check the first entry…
|
||||
sharedDefType = foldl' sameOrNull (head defTypes) defTypes;
|
||||
allChecked = all (x: check x) vals;
|
||||
allChecked = all check vals;
|
||||
in
|
||||
if sharedDefType == null then
|
||||
throw (
|
||||
|
||||
@@ -138,7 +138,7 @@ let
|
||||
submoduleToAttrs = m: lib.filterAttrs (name: v: name != "_module" && v != null) m;
|
||||
in
|
||||
lib.generators.toINI { mkSectionName = mk2ndLevelSectionName; } (
|
||||
lib.mapAttrs (name: x: submoduleToAttrs x) cfg.tags
|
||||
lib.mapAttrs (name: submoduleToAttrs) cfg.tags
|
||||
)
|
||||
)
|
||||
+ ''
|
||||
|
||||
@@ -193,7 +193,7 @@ in
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
home.sessionVariables = lib.mapAttrs (n: v: toString v) (
|
||||
home.sessionVariables = lib.mapAttrs (n: toString) (
|
||||
lib.filterAttrs (n: v: v != [ ] && v != null) {
|
||||
FZF_ALT_C_COMMAND = cfg.changeDirWidgetCommand;
|
||||
FZF_ALT_C_OPTS = cfg.changeDirWidgetOptions;
|
||||
|
||||
@@ -144,7 +144,7 @@ in
|
||||
if lib.isBool v then
|
||||
"${optionalString (!v) "no"}${k}"
|
||||
else if lib.isList v then
|
||||
''${k} "${concatStringsSep ":" (map (w: toString w) v)}"''
|
||||
''${k} "${concatStringsSep ":" (map toString v)}"''
|
||||
else
|
||||
"${k} ${if lib.isInt v then toString v else ''"${v}"''}"
|
||||
}";
|
||||
|
||||
@@ -31,7 +31,7 @@ let
|
||||
path = int;
|
||||
bool = "0"; # "on/off" opts are disabled with `=0`
|
||||
string = option;
|
||||
list = lib.concatStringsSep "," (lib.lists.forEach option (x: toString x));
|
||||
list = lib.concatStringsSep "," (lib.lists.forEach option toString);
|
||||
}
|
||||
.${builtins.typeOf option};
|
||||
|
||||
|
||||
@@ -210,9 +210,7 @@ let
|
||||
genGroupsChannels = group: concatStringsSep "\n" (genChannelStrings group.name group.channels);
|
||||
# Generate all channel configurations for all groups for this account.
|
||||
in
|
||||
concatStringsSep "\n" (
|
||||
lib.remove "" (mapAttrsToList (name: group: genGroupsChannels group) groups)
|
||||
);
|
||||
concatStringsSep "\n" (lib.remove "" (mapAttrsToList (name: genGroupsChannels) groups));
|
||||
|
||||
# Given the attr set of groups, return a string which maps channels to groups
|
||||
genAccountGroups =
|
||||
|
||||
@@ -98,7 +98,7 @@ in
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
home.sessionVariables = lib.mapAttrs (n: v: toString v) (
|
||||
home.sessionVariables = lib.mapAttrs (n: toString) (
|
||||
lib.filterAttrs (n: v: v != [ ] && v != null) {
|
||||
SKIM_ALT_C_COMMAND = cfg.changeDirWidgetCommand;
|
||||
SKIM_ALT_C_OPTS = cfg.changeDirWidgetOptions;
|
||||
|
||||
@@ -294,7 +294,7 @@ let
|
||||
version="9"
|
||||
logging="no"
|
||||
''
|
||||
+ lib.concatStrings (map (f: mkFilterToIniString f) filters);
|
||||
+ lib.concatStrings (map mkFilterToIniString filters);
|
||||
|
||||
getAccountsForProfile =
|
||||
profileName: accounts:
|
||||
|
||||
@@ -75,9 +75,9 @@ let
|
||||
getAttrs [ "collections" "conflictResolution" "metadata" "partialSync" ] a.vdirsyncer
|
||||
);
|
||||
|
||||
pairs = mapAttrs (_: v: pair v) vdirsyncerAccounts;
|
||||
localStorages = mapAttrs (_: v: localStorage v) vdirsyncerAccounts;
|
||||
remoteStorages = mapAttrs (_: v: remoteStorage v) vdirsyncerAccounts;
|
||||
pairs = mapAttrs (_: pair) vdirsyncerAccounts;
|
||||
localStorages = mapAttrs (_: localStorage) vdirsyncerAccounts;
|
||||
remoteStorages = mapAttrs (_: remoteStorage) vdirsyncerAccounts;
|
||||
|
||||
optionString =
|
||||
n: v:
|
||||
|
||||
@@ -41,7 +41,7 @@ let
|
||||
description = "pair of ${x.description}";
|
||||
};
|
||||
|
||||
mkDefaultAttrs = mapAttrs (n: v: mkDefault v);
|
||||
mkDefaultAttrs = mapAttrs (n: mkDefault);
|
||||
|
||||
# Basically a tinkered lib.generators.mkKeyValueDefault
|
||||
# It either serializes a top-level definition "key: { values };"
|
||||
|
||||
@@ -188,7 +188,7 @@ in
|
||||
in
|
||||
if allQuadletsSameType then
|
||||
''
|
||||
${concatStringsSep "\n" (map (quadlet: formatServiceName quadlet) quadlets)}
|
||||
${concatStringsSep "\n" (map formatServiceName quadlets)}
|
||||
''
|
||||
else
|
||||
abort ''
|
||||
|
||||
@@ -65,7 +65,7 @@ let
|
||||
# top-level attributes with non-attrsets so we're forcing the attrsets to
|
||||
# come last.
|
||||
_config = lib.mapAttrsToList convert (lib.filterAttrs (k: v: !isAttrs v) attr);
|
||||
_config' = lib.mapAttrsToList convert (lib.filterAttrs (k: v: isAttrs v) attr);
|
||||
_config' = lib.mapAttrsToList convert (lib.filterAttrs (k: isAttrs) attr);
|
||||
config = _config ++ _config';
|
||||
in
|
||||
lib.concatStringsSep "\n" config;
|
||||
|
||||
@@ -5,7 +5,6 @@ disabled = [
|
||||
"deprecated_to_path",
|
||||
"empty_inherit",
|
||||
"empty_let_in",
|
||||
"eta_reduction",
|
||||
"faster_groupby",
|
||||
"faster_zipattrswith",
|
||||
"legacy_let_syntax",
|
||||
|
||||
Reference in New Issue
Block a user