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

@@ -110,8 +110,7 @@ let
in
pkgs.buildPackages.nixosOptionsDoc (
{
options =
if includeModuleSystemOptions then options else builtins.removeAttrs options [ "_module" ];
options = if includeModuleSystemOptions then options else removeAttrs options [ "_module" ];
transformOptions =
opt:
opt
@@ -133,7 +132,7 @@ let
) opt.declarations;
};
}
// builtins.removeAttrs args [
// removeAttrs args [
"modules"
"includeModuleSystemOptions"
]

View File

@@ -31,7 +31,7 @@ let
modules = [ configuration ] ++ hmModules;
class = "homeManager";
specialArgs = {
modulesPath = builtins.toString ./.;
modulesPath = toString ./.;
}
// extraSpecialArgs;
};

View File

@@ -192,7 +192,7 @@ in
++ lib.optionals (cfg.quickPhraseFiles != { }) [
(pkgs.linkFarm "quickPhraseFiles" (
lib.mapAttrs' (
name: value: lib.nameValuePair ("share/fcitx5/data/quickphrase.d/${name}.mb") value
name: value: lib.nameValuePair "share/fcitx5/data/quickphrase.d/${name}.mb" value
) cfg.quickPhraseFiles
))
];

View File

@@ -13,12 +13,9 @@ let
mergeDefinitions
;
inherit (builtins)
map
filter
length
deepSeq
throw
toString
concatLists
;
inherit (lib.options) showDefs;

View File

@@ -278,7 +278,7 @@ in
else if builtins.isString value then
"<const>${value}</const>"
else
throw ("expected bool or string but got ${builtins.typeOf value}: ${toString value}");
throw "expected bool or string but got ${builtins.typeOf value}: ${toString value}";
in
''
<match target="font">
@@ -338,7 +338,7 @@ in
xdg.configFile = lib.mapAttrs' (
name: config:
lib.nameValuePair "fontconfig/conf.d/${builtins.toString config.priority}-hm-${config.label}.conf" {
lib.nameValuePair "fontconfig/conf.d/${toString config.priority}-hm-${config.label}.conf" {
inherit (config) enable text;
source = lib.mkIf (config.source != null) config.source;
}

View File

@@ -72,7 +72,7 @@ let
fileList ++ subdirFiles;
newsFiles = collectNixFiles ./news;
newsEntries = builtins.map (
newsEntries = map (
newsFile:
let
imported = import newsFile;

View File

@@ -47,9 +47,9 @@ in
desktop: terminals:
# Map desktop name such as GNOME to `.config/gnome-xdg-terminals.list`,
# default to `.config/xdg-terminals.list`.
lib.nameValuePair (
"${if desktop == "default" then "" else "${lib.toLower desktop}-"}xdg-terminals.list"
) { text = lib.concatLines terminals; }
lib.nameValuePair "${
if desktop == "default" then "" else "${lib.toLower desktop}-"
}xdg-terminals.list" { text = lib.concatLines terminals; }
) cfg.settings;
};
}

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";

View File

@@ -127,7 +127,7 @@ in
};
Service = {
Environment = with pkgs; "PATH=${makeBinPath cfg.extraPackages}";
Environment = "PATH=${makeBinPath cfg.extraPackages}";
ExecStart = "${cfg.package}/bin/fusuma";
};

View File

@@ -168,7 +168,7 @@ in
packages = [ cfg.package ];
sessionVariables = mkIf cfg.enableSessionVariables (
{
MPD_PORT = builtins.toString cfg.network.port;
MPD_PORT = toString cfg.network.port;
}
// lib.optionalAttrs (cfg.network.listenAddress != "any") {
MPD_HOST = cfg.network.listenAddress;

View File

@@ -23,9 +23,9 @@ let
${k}='' (mapAttrsToList normalizeKeyValue v))
else
builtins.toString v;
toString v;
in
if builtins.isNull v then "" else "${k}=${v'}";
if isNull v then "" else "${k}=${v'}";
primitiveAttrs = with types; attrsOf (either primitive (listOf primitive));
primitiveList = with types; listOf primitive;

View File

@@ -15,7 +15,7 @@ let
''}
USE_BACKUP="${if cfg.useBackup then "yes" else "no"}"
BACKUP_LIMIT=${builtins.toString cfg.backupLimit}
BACKUP_LIMIT=${toString cfg.backupLimit}
'';
in
{

View File

@@ -103,7 +103,7 @@ in
StopWhenUnneeded = cfg.node.lazy.enable;
ConditionPathExists = radicleKeyPair;
};
Service = mkMerge ([
Service = mkMerge [
{
Slice = "session.slice";
ExecStart = "${getExe' cfg.node.package "radicle-node"} ${cfg.node.args}";
@@ -182,7 +182,7 @@ in
"~@setuid"
];
}
]);
];
};
"radicle-node-proxy" = mkIf cfg.node.lazy.enable {
Unit = {

View File

@@ -359,7 +359,7 @@ in
) cfg.submaps;
submapWarnings = lib.mapAttrsToList (submapName: nonBinds: ''
wayland.windowManager.hyprland.submaps."${submapName}".settings: found non-bind entries: [${builtins.toString nonBinds}], which will have no effect in a submap
wayland.windowManager.hyprland.submaps."${submapName}".settings: found non-bind entries: [${toString nonBinds}], which will have no effect in a submap
'') (lib.filterAttrs (n: v: v != [ ]) submapWarningsAttrset);
in
submapWarnings ++ lib.optional inconsistent warning;

View File

@@ -98,7 +98,7 @@ let
attrName = builtins.substring 1 999 k; # Remove "@" prefix
attrValue = value.${k};
in
" ${attrName}=\"${escape (builtins.toString attrValue)}\""
" ${attrName}=\"${escape (toString attrValue)}\""
) attrKeys
);
@@ -125,7 +125,7 @@ let
# All other primitive values: wrap in start/end tag
else
"<${name}>${escape (builtins.toString value)}</${name}>";
"<${name}>${escape (toString value)}</${name}>";
generateXML = name: config: extraConfig: ''
<?xml version="1.0" encoding="UTF-8"?>
@@ -139,7 +139,7 @@ let
else if name == "labwc_config" then
lib.mapAttrsToList generateRc
else
builtins.throw "error ${name} is neither openbox_menu nor labwc_config"
throw "error ${name} is neither openbox_menu nor labwc_config"
)
config
)

View File

@@ -75,7 +75,7 @@ let
buildServices =
style: serviceCfgs: lib.concatLists (lib.mapAttrsToList (buildService style) serviceCfgs);
servicesStartTimeoutMs = builtins.toString cfg.servicesStartTimeoutMs;
servicesStartTimeoutMs = toString cfg.servicesStartTimeoutMs;
unitBaseType =
unitKind: mod:

View File

@@ -211,7 +211,7 @@ in
makePackageWrapper =
vendor: environment: pkg:
if builtins.isNull cfg.packages then
if isNull cfg.packages then
pkg
else
# Wrap the package's binaries with nixGL, while preserving the rest of

View File

@@ -29,7 +29,7 @@ let
lib = extendedLib;
osConfig = config;
osClass = _class;
modulesPath = builtins.toString ../modules;
modulesPath = toString ../modules;
}
// cfg.extraSpecialArgs;

View File

@@ -24,7 +24,7 @@ let
'';
xdgRuntimeDir = "/run/user/${builtins.toString config.nodes.machine.users.users.alice.uid}";
xdgRuntimeDir = "/run/user/${toString config.nodes.machine.users.users.alice.uid}";
httpHeadersSecret = pkgs.writeText "http-headers" "Cookie,secret_password=aliceiscool";
shellVar = mkHttpModule "\\\${XDG_RUNTIME_DIR}/http-headers";

View File

@@ -17,7 +17,7 @@
};
};
nixpkgs.overlays = [
(self: super: rec {
(self: super: {
openshift = config.lib.test.mkStubPackage {
name = "openshift";
version = "4.16.0";

View File

@@ -20,7 +20,7 @@
# plugins without associated config should not trigger the creation of init.vim
plugins = with pkgs.vimPlugins; [
vim-fugitive
({ plugin = vim-sensible; })
{ plugin = vim-sensible; }
];
};
nmt.script = ''