treewide: nixf-diagnose cleanup

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
Austin Horstman
2026-01-08 13:02:58 -06:00
parent 9fff37e6ff
commit fa6de26b4d
51 changed files with 78 additions and 88 deletions

View File

@@ -104,7 +104,7 @@ in
};
stylesets = mkOption {
type = with types; attrsOf (sectionsOrLines);
type = with types; attrsOf sectionsOrLines;
default = { };
example = literalExpression ''
{ default = { ui = { "tab.selected.reverse" = "toggle"; }; }; };

View File

@@ -6,9 +6,7 @@
}:
let
inherit (builtins)
map
toJSON
toString
substring
stringLength
;

View File

@@ -281,7 +281,7 @@ in
) supportedBrowsers;
config = lib.mkMerge (
builtins.map (browser: browserConfig browser config.programs.${browser}) (
map (browser: browserConfig browser config.programs.${browser}) (
builtins.attrNames supportedBrowsers
)
);

View File

@@ -16,8 +16,7 @@ let
generateConfig = lib.generators.toKeyValue {
mkKeyValue =
name: value:
if lib.isString value then ''${name}="${value}"'' else "${name}=${builtins.toString value}";
name: value: if lib.isString value then ''${name}="${value}"'' else "${name}=${toString value}";
};
iniFormat = pkgs.formats.ini { listsAsDuplicateKeys = true; };

View File

@@ -103,7 +103,7 @@ in
{
name = path;
value = {
source = jsonFormat.generate "config.json" (ctx);
source = jsonFormat.generate "config.json" ctx;
};
}
) cfg.contexts;

View File

@@ -471,7 +471,7 @@ in
order = mkOption {
type = with types; uniq (listOf str);
apply = builtins.map migrateEngineNameToIdV7;
apply = map migrateEngineNameToIdV7;
default = [ ];
example = [
"ddg"

View File

@@ -627,7 +627,7 @@ in
package
]
++ lib.filter (p: p != null) (
builtins.map (outName: package.${outName} or null) config.home.extraOutputsToInstall
map (outName: package.${outName} or null) config.home.extraOutputsToInstall
);
nativeBuildInputs = [ pkgs.python3 ];
buildInputs = [ cfg.package ];

View File

@@ -204,7 +204,7 @@ in
xdg.dataFile."gh/extensions" = mkIf (cfg.extensions != [ ]) {
source = pkgs.linkFarm "gh-extensions" (
builtins.map (p: {
map (p: {
name = p.pname;
path = "${p}/bin";
}) cfg.extensions

View File

@@ -9,7 +9,7 @@ let
iniFormat = pkgs.formats.ini { };
in
{
meta.maintainers = with lib.maintainers; [ ];
meta.maintainers = [ ];
options.programs.havoc = {
enable = lib.mkEnableOption "Havoc terminal";

View File

@@ -70,7 +70,7 @@ in
"mako"
];
in
builtins.map (name: {
map (name: {
assertion = !config.services.${name}.enable;
message = ''
Only one notification daemon can be enabled at once. You have enabled

View File

@@ -139,7 +139,7 @@ in
in
lib.hm.dag.entryAfter [ "linkGeneration" ] ''
# Ensure that settings.json exists.
mkdir -p ${builtins.dirOf configPath}
mkdir -p ${dirOf configPath}
touch ${configPath}
# Config has to be written to temporary variable because jq cannot edit files in place.
config="$(jq -s '.[0] + .[1]' ${configPath} ${newConfig})"

View File

@@ -14,7 +14,7 @@ let
renderSettings =
with lib.generators;
toINI {
mkKeyValue = mkKeyValueDefault rec {
mkKeyValue = mkKeyValueDefault {
mkValueString =
v:
if lib.isList v then
@@ -139,7 +139,7 @@ in
let
makePath =
baseDir: subDir:
builtins.toString (
toString (
/.
+ lib.concatStringsSep "/" [
baseDir

View File

@@ -201,7 +201,7 @@ let
plugins:
pkgs.linkFarm "lapce-plugins" (
builtins.listToAttrs (
builtins.map (
map (
{
author,
name,

View File

@@ -82,7 +82,7 @@ in
package = lib.mkPackageOption pkgs "meli" { };
includes = mkOption {
type = with types; listOf (str);
type = with types; listOf str;
description = "Paths of the various meli configuration files to include.";
default = [ ];
};

View File

@@ -13,7 +13,7 @@ let
renderSettings = settings: lib.concatStringsSep ";" (lib.mapAttrsToList renderSetting settings);
pluginModule = types.submodule ({
pluginModule = types.submodule {
options = {
src = mkOption {
type = with types; nullOr path;
@@ -46,7 +46,7 @@ let
'';
};
};
});
};
in
{
meta.maintainers = with lib.maintainers; [ thiagokokada ];

View File

@@ -254,7 +254,7 @@ in
cssSnippets =
let
checkCssPath = path: lib.filesystem.pathIsRegularFile path && lib.strings.hasSuffix ".css" path;
toCssName = path: lib.strings.removeSuffix ".css" (builtins.baseNameOf path);
toCssName = path: lib.strings.removeSuffix ".css" (baseNameOf path);
cssSnippetsOptions =
{ config, ... }:
{
@@ -423,7 +423,7 @@ in
source = (pkgs.formats.json { }).generate "appearance.json" (
vault.settings.appearance
// {
enabledCssSnippets = builtins.map (snippet: snippet.name) enabledCssSnippets;
enabledCssSnippets = map (snippet: snippet.name) enabledCssSnippets;
}
// lib.attrsets.optionalAttrs (activeTheme != null) {
cssTheme = getManifest activeTheme;
@@ -438,14 +438,14 @@ in
{
name = "${vault.target}/.obsidian/core-plugins.json";
value.source = (pkgs.formats.json { }).generate "core-plugins.json" (
builtins.map (plugin: plugin.name) vault.settings.corePlugins
map (plugin: plugin.name) vault.settings.corePlugins
);
}
{
name = "${vault.target}/.obsidian/core-plugins-migration.json";
value.source = (pkgs.formats.json { }).generate "core-plugins-migration.json" (
builtins.listToAttrs (
builtins.map (name: {
map (name: {
inherit name;
value = builtins.any (plugin: name == plugin.name && plugin.enable) vault.settings.corePlugins;
}) corePlugins
@@ -453,7 +453,7 @@ in
);
}
]
++ builtins.map (plugin: {
++ map (plugin: {
name = "${vault.target}/.obsidian/${plugin.name}.json";
value.source = (pkgs.formats.json { }).generate "${plugin.name}.json" plugin.settings;
}) (builtins.filter (plugin: plugin.settings != { }) vault.settings.corePlugins);
@@ -464,25 +464,25 @@ in
{
name = "${vault.target}/.obsidian/community-plugins.json";
value.source = (pkgs.formats.json { }).generate "community-plugins.json" (
builtins.map getManifest (builtins.filter (plugin: plugin.enable) vault.settings.communityPlugins)
map getManifest (builtins.filter (plugin: plugin.enable) vault.settings.communityPlugins)
);
}
]
++ builtins.map (plugin: {
++ map (plugin: {
name = "${vault.target}/.obsidian/plugins/${getManifest plugin}";
value = {
source = plugin.pkg;
recursive = true;
};
}) vault.settings.communityPlugins
++ builtins.map (plugin: {
++ map (plugin: {
name = "${vault.target}/.obsidian/plugins/${getManifest plugin}/data.json";
value.source = (pkgs.formats.json { }).generate "data.json" plugin.settings;
}) (builtins.filter (plugin: plugin.settings != { }) vault.settings.communityPlugins);
mkCssSnippets =
vault:
builtins.map (snippet: {
map (snippet: {
name = "${vault.target}/.obsidian/snippets/${snippet.name}.css";
value =
if snippet.source != null then
@@ -497,7 +497,7 @@ in
mkThemes =
vault:
builtins.map (theme: {
map (theme: {
name = "${vault.target}/.obsidian/themes/${getManifest theme}";
value.source = theme.pkg;
}) vault.settings.themes;
@@ -509,7 +509,7 @@ in
mkExtraFiles =
vault:
builtins.map (file: {
map (file: {
name = "${vault.target}/.obsidian/${file.target}";
value =
if file.source != null then
@@ -524,7 +524,7 @@ in
in
builtins.listToAttrs (
lib.lists.flatten (
builtins.map (vault: [
map (vault: [
(mkApp vault)
(mkAppearance vault)
(mkCorePlugins vault)
@@ -540,7 +540,7 @@ in
xdg.configFile."obsidian/obsidian.json".source = (pkgs.formats.json { }).generate "obsidian.json" {
vaults = builtins.listToAttrs (
builtins.map (vault: {
map (vault: {
name = builtins.hashString "md5" vault.target;
value = {
path = "${config.home.homeDirectory}/${vault.target}";

View File

@@ -19,11 +19,11 @@ let
valueToString =
value:
if builtins.isList value then
builtins.concatStringsSep "," (builtins.map valueToString value)
builtins.concatStringsSep "," (map valueToString value)
else if builtins.isAttrs value then
valueToString (lib.mapAttrsToList (key: val: "${valueToString key}=${valueToString val}") value)
else
builtins.toString value;
toString value;
modulesArgument = optionalString (cfg.modules != null) " -modules ${valueToString cfg.modules}";

View File

@@ -27,7 +27,7 @@ let
else if builtins.isList v then
"[${concatStringsSep ", " (map pythonize v)}]"
else
builtins.toString v;
toString v;
formatDictLine =
o: n: v:

View File

@@ -168,7 +168,7 @@ in
}
{
assertion = cfg.uri.web-rad.enable -> cfg.uri.web-rad.browser != null;
message = "Could not detect preferred browser. Please set `${builtins.toString opt.uri.web-rad.browser}`.";
message = "Could not detect preferred browser. Please set `${toString opt.uri.web-rad.browser}`.";
}
{
assertion =

View File

@@ -71,7 +71,7 @@ in
home.file.".rbenv/plugins" = mkIf (cfg.plugins != [ ]) {
source = pkgs.linkFarm "rbenv-plugins" (
builtins.map (p: {
map (p: {
name = p.name;
path = p.src;
}) cfg.plugins

View File

@@ -135,7 +135,7 @@ let
modes = map (mode: if isString mode then mode else "${mode.name}:${mode.path}") cfg.modes;
in
{
meta.maintainers = with lib.maintainers; [ ];
meta.maintainers = [ ];
options.programs.rofi = {
enable = lib.mkEnableOption "Rofi: A window switcher, application launcher and dmenu replacement";

View File

@@ -158,7 +158,7 @@ in
prjConf =
lib.attrsets.mapAttrs' (
name: value:
(lib.attrsets.nameValuePair (if name == "beforeStart" then "before_start" else name) (value))
(lib.attrsets.nameValuePair (if name == "beforeStart" then "before_start" else name) value)
) v
// {
session = k;

View File

@@ -23,9 +23,9 @@ let
if (builtins.isBool value) then
if value then name else ""
else if (builtins.isList value) then
lib.concatStringsSep "\n" (builtins.map (item: "${name}=${builtins.toString item}") value)
lib.concatStringsSep "\n" (map (item: "${name}=${toString item}") value)
else
"${name}=${builtins.toString value}"
"${name}=${toString value}"
) settings
)
);

View File

@@ -85,8 +85,7 @@ in
if v == false then
""
else
(if v == true then n else n + "=" + (if builtins.isPath v then "${v}" else builtins.toString v))
+ "\n"
(if v == true then n else n + "=" + (if builtins.isPath v then "${v}" else toString v)) + "\n"
) cfg.settings
);
};

View File

@@ -183,14 +183,12 @@ let
3;
"mail.smtpserver.smtp_${id}.username" = account.userName;
}
// builtins.foldl' (a: b: a // b) { } (
builtins.map (address: toThunderbirdSMTP account address) addresses
)
// builtins.foldl' (a: b: a // b) { } (map (address: toThunderbirdSMTP account address) addresses)
// optionalAttrs (account.smtp != null && account.primary) {
"mail.smtp.defaultserver" = "smtp_${id}";
}
// builtins.foldl' (a: b: a // b) { } (
builtins.map (address: toThunderbirdIdentity account address) addresses
map (address: toThunderbirdIdentity account address) addresses
)
// account.thunderbird.settings id;

View File

@@ -69,7 +69,7 @@ in
let
conf =
optional (cfg.host != null) ''set -g tmate-server-host "${cfg.host}"''
++ optional (cfg.port != null) "set -g tmate-server-port ${builtins.toString cfg.port}"
++ optional (cfg.port != null) "set -g tmate-server-port ${toString cfg.port}"
++ optional (
cfg.dsaFingerprint != null
) ''set -g tmate-server-ed25519-fingerprint "${cfg.dsaFingerprint}"''

View File

@@ -240,7 +240,7 @@ in
dataFile =
builtins.listToAttrs (
builtins.map (item: {
map (item: {
name = "vicinae/extensions/${item.name}";
value.source = item;
}) cfg.extensions
@@ -263,7 +263,7 @@ in
KillMode = "process";
EnvironmentFile = lib.mkIf (!versionPost0_17) (
pkgs.writeText "vicinae-env" ''
USE_LAYER_SHELL=${if cfg.useLayerShell then builtins.toString 1 else builtins.toString 0}
USE_LAYER_SHELL=${if cfg.useLayerShell then toString 1 else toString 0}
''
);
};

View File

@@ -517,7 +517,7 @@ in
else
{ };
# Merge MCP servers: transformed servers + user servers, with user servers taking precedence
mergedServers = transformedMcpServers // ((v.userMcp.servers or { }));
mergedServers = transformedMcpServers // (v.userMcp.servers or { });
# Merge all MCP config
mergedMcpConfig =
v.userMcp // (lib.optionalAttrs (mergedServers != { }) { servers = mergedServers; });

View File

@@ -301,7 +301,7 @@ in
{
assertions = [
(lib.hm.assertions.assertPlatform "programs.waybar" pkgs lib.platforms.linux)
({
{
assertion =
if lib.versionAtLeast config.home.stateVersion "22.05" then
all (x: !hasAttr "modules" x || x.modules == null) settings
@@ -311,7 +311,7 @@ in
The `programs.waybar.settings.[].modules` option has been removed.
It is now possible to declare modules in the configuration without nesting them under the `modules` option.
'';
})
}
];
home.packages = [ cfg.package ];

View File

@@ -58,7 +58,7 @@ in
xdg.configFile."waylogout/config" = lib.mkIf (cfg.settings != { }) {
text = lib.concatStrings (
lib.mapAttrsToList (
n: v: if v == false then "" else (if v == true then n else n + "=" + builtins.toString v) + "\n"
n: v: if v == false then "" else (if v == true then n else n + "=" + toString v) + "\n"
) cfg.settings
);
};

View File

@@ -35,7 +35,7 @@ let
'';
}
else
builtins.dirOf value;
dirOf value;
makePluginSearchPath = p: "${p}/?/init.lua;${p}/?.lua";
@@ -46,9 +46,9 @@ let
searchPaths = map makePluginSearchPath wrappedPlugins;
pluginSearchPath = lib.concatStringsSep ";" searchPaths;
in
(''
''
package.path = "${pluginSearchPath};" .. package.path
'')
''
else
"\n";