From 2b73c2fcca690b6eca4f520179e54ae760f25d4e Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Sat, 26 Jul 2025 17:11:53 -0500 Subject: [PATCH] treewide: remove config dependency on docs (#7547) Tested with rebased https://github.com/nix-community/home-manager/pull/6411 so I could find all instances of config usage in docs. Signed-off-by: Austin Horstman Co-authored-by: Robert Helgesson --- modules/misc/nixgl.nix | 27 ++++++++++--------- modules/programs/ashell.nix | 3 ++- modules/programs/chromium.nix | 10 +++---- modules/programs/codex.nix | 3 ++- modules/programs/firefox/mkFirefoxModule.nix | 1 + modules/programs/hyprlock.nix | 19 +++---------- modules/programs/keychain.nix | 1 - modules/programs/obsidian.nix | 8 ++++++ modules/programs/swayr.nix | 1 + modules/programs/vscode/default.nix | 1 + modules/programs/yambar.nix | 1 + modules/services/cliphist.nix | 1 + modules/services/hyprshell.nix | 1 + modules/services/window-managers/hyprland.nix | 9 ++++--- .../window-managers/i3-sway/lib/options.nix | 7 +++++ .../services/window-managers/i3-sway/sway.nix | 20 ++++++++++++++ modules/services/wlsunset.nix | 1 + 17 files changed, 73 insertions(+), 41 deletions(-) diff --git a/modules/misc/nixgl.nix b/modules/misc/nixgl.nix index 0cc3fe4d..1a99228a 100644 --- a/modules/misc/nixgl.nix +++ b/modules/misc/nixgl.nix @@ -7,15 +7,16 @@ let cfg = config.nixGL; - wrapperListMarkdown = - with builtins; - foldl' ( - list: name: - list - + '' - - ${name} - '' - ) "" (attrNames config.lib.nixGL.wrappers); + + wrapperAttrNames = [ + "mesa" + "mesaPrime" + "nvidia" + "nvidiaPrime" + ]; + + wrapperListMarkdown = lib.concatMapStringsSep "\n" (v: "- ${v}") wrapperAttrNames; + in { meta.maintainers = [ lib.maintainers.smona ]; @@ -42,7 +43,7 @@ in }; defaultWrapper = lib.mkOption { - type = lib.types.enum (builtins.attrNames config.lib.nixGL.wrappers); + type = lib.types.enum wrapperAttrNames; default = "mesa"; description = '' The package wrapper function available for use as `(config.lib.nixGL.wrap @@ -58,7 +59,7 @@ in }; offloadWrapper = lib.mkOption { - type = lib.types.enum (builtins.attrNames config.lib.nixGL.wrappers); + type = lib.types.enum wrapperAttrNames; default = "mesaPrime"; description = '' The package wrapper function available for use as @@ -124,7 +125,7 @@ in }; installScripts = lib.mkOption { - type = with lib.types; nullOr (listOf (enum (builtins.attrNames config.lib.nixGL.wrappers))); + type = with lib.types; nullOr (listOf (enum wrapperAttrNames)); default = null; example = [ "mesa" @@ -282,6 +283,8 @@ in override = args: makePackageWrapper vendor environment (pkg.override args); }; + # Note, if you add/remove/alter attribute names here you need to make a + # corresponding change in the definition of `wrapperAttrNames`. wrappers = { mesa = makePackageWrapper "Intel" { }; mesaPrime = makePackageWrapper "Intel" mesaOffloadEnv; diff --git a/modules/programs/ashell.nix b/modules/programs/ashell.nix index 309e7642..69a7fa5a 100644 --- a/modules/programs/ashell.nix +++ b/modules/programs/ashell.nix @@ -33,7 +33,8 @@ in package = lib.mkPackageOption pkgs "ashell" { nullable = true; }; settings = lib.mkOption { - inherit (settingsFormat) type; + # NOTE: `yaml` type supports null, using `nullOr` for backwards compatibility period + type = lib.types.nullOr tomlFormat.type; default = { }; example = { modules = { diff --git a/modules/programs/chromium.nix b/modules/programs/chromium.nix index aa115cb6..01c67ea2 100644 --- a/modules/programs/chromium.nix +++ b/modules/programs/chromium.nix @@ -77,30 +77,26 @@ let updateUrl = mkOption { type = str; + default = "https://clients2.google.com/service/update2/crx"; description = '' URL of the extension's update manifest XML file. Linux only. ''; - default = "https://clients2.google.com/service/update2/crx"; - visible = pkgs.stdenv.isLinux; - readOnly = pkgs.stdenv.isDarwin; }; crxPath = mkOption { type = nullOr path; + default = null; description = '' Path to the extension's crx file. Linux only. ''; - default = null; - visible = pkgs.stdenv.isLinux; }; version = mkOption { type = nullOr str; + default = null; description = '' The extension's version, required for local installation. Linux only. ''; - default = null; - visible = pkgs.stdenv.isLinux; }; }; }; diff --git a/modules/programs/codex.nix b/modules/programs/codex.nix index 17a1d2ac..d64910eb 100644 --- a/modules/programs/codex.nix +++ b/modules/programs/codex.nix @@ -28,7 +28,8 @@ in package = lib.mkPackageOption pkgs "codex" { nullable = true; }; settings = lib.mkOption { - inherit (settingsFormat) type; + # NOTE: `yaml` type supports null, using `nullOr` for backwards compatibility period + type = lib.types.nullOr tomlFormat.type; description = '' Configuration written to {file}`~/.codex/config.toml` (0.2.0+) or {file}`~/.codex/config.yaml` (<0.2.0). See for supported values. diff --git a/modules/programs/firefox/mkFirefoxModule.nix b/modules/programs/firefox/mkFirefoxModule.nix index 2f0a00f5..df0a4c19 100644 --- a/modules/programs/firefox/mkFirefoxModule.nix +++ b/modules/programs/firefox/mkFirefoxModule.nix @@ -297,6 +297,7 @@ in internal = true; type = with types; nullOr str; default = null; + defaultText = literalExpression "platform specific vendor path"; example = ".mozilla"; description = "Directory containing the native messaging hosts directory."; }; diff --git a/modules/programs/hyprlock.nix b/modules/programs/hyprlock.nix index a634c7c6..4ef81a16 100644 --- a/modules/programs/hyprlock.nix +++ b/modules/programs/hyprlock.nix @@ -105,13 +105,9 @@ in ''; }; - sourceFirst = - lib.mkEnableOption '' - putting source entries at the top of the configuration - '' - // { - default = true; - }; + sourceFirst = lib.mkEnableOption "putting source entries at the top of the configuration" // { + default = true; + }; importantPrefixes = lib.mkOption { type = with lib.types; listOf str; @@ -120,13 +116,6 @@ in "bezier" "monitor" "size" - ] - ++ lib.optionals cfg.sourceFirst [ "source" ]; - example = [ - "$" - "bezier" - "monitor" - "size" ]; description = '' List of prefix of attributes to source at the top of the config. @@ -146,7 +135,7 @@ in lib.optionalString (cfg.settings != { }) ( lib.hm.generators.toHyprconf { attrs = cfg.settings; - inherit (cfg) importantPrefixes; + importantPrefixes = cfg.importantPrefixes ++ lib.optional cfg.sourceFirst "source"; } ) + lib.optionalString (cfg.extraConfig != null) cfg.extraConfig; diff --git a/modules/programs/keychain.nix b/modules/programs/keychain.nix index 023c4d1b..4c8040b5 100644 --- a/modules/programs/keychain.nix +++ b/modules/programs/keychain.nix @@ -75,7 +75,6 @@ in enableXsessionIntegration = mkOption { default = true; type = types.bool; - visible = pkgs.stdenv.hostPlatform.isLinux; description = '' Whether to run keychain from your {file}`~/.xsession`. ''; diff --git a/modules/programs/obsidian.nix b/modules/programs/obsidian.nix index 787a917d..fa9c1dbd 100644 --- a/modules/programs/obsidian.nix +++ b/modules/programs/obsidian.nix @@ -177,12 +177,14 @@ in description = "Settings to write to app.json."; type = with types; attrsOf anything; default = cfg.defaultSettings.app; + defaultText = literalExpression "config.programs.obsidian.defaultSettings.app"; }; appearance = mkOption { description = "Settings to write to appearance.json."; type = with types; attrsOf anything; default = cfg.defaultSettings.appearance; + defaultText = literalExpression "config.programs.obsidian.defaultSettings.appearance"; }; corePlugins = @@ -214,6 +216,7 @@ in with types; listOf (coercedTo (enum corePlugins) (p: { name = p; }) (submodule corePluginsOptions)); default = cfg.defaultSettings.corePlugins; + defaultText = literalExpression "config.programs.obsidian.defaultSettings.corePlugins"; }; communityPlugins = @@ -243,6 +246,7 @@ in description = "Community plugins to install and activate."; type = with types; listOf (coercedTo package (p: { pkg = p; }) (submodule communityPluginsOptions)); default = cfg.defaultSettings.communityPlugins; + defaultText = literalExpression "config.programs.obsidian.defaultSettings.communityPlugins"; }; cssSnippets = @@ -287,6 +291,7 @@ in with types; listOf (coercedTo (addCheck path checkCssPath) (p: { source = p; }) (submodule cssSnippetsOptions)); default = cfg.defaultSettings.cssSnippets; + defaultText = literalExpression "config.programs.obsidian.defaultSettings.cssSnippets"; }; themes = @@ -310,6 +315,7 @@ in description = "Themes to install."; type = with types; listOf (coercedTo package (p: { pkg = p; }) (submodule themesOptions)); default = cfg.defaultSettings.themes; + defaultText = literalExpression "config.programs.obsidian.defaultSettings.themes"; }; hotkeys = @@ -333,6 +339,7 @@ in description = "Hotkeys to configure."; type = with types; attrsOf (listOf (submodule hotkeysOptions)); default = cfg.defaultSettings.hotkeys; + defaultText = literalExpression "config.programs.obsidian.defaultSettings.hotkeys"; }; extraFiles = @@ -367,6 +374,7 @@ in description = "Extra files to link to the vault directory."; type = with types; attrsOf (submodule extraFilesOptions); default = cfg.defaultSettings.extraFiles; + defaultText = literalExpression "config.programs.obsidian.defaultSettings.extraFiles"; }; }; }; diff --git a/modules/programs/swayr.nix b/modules/programs/swayr.nix index 11f8692e..7c68a5c6 100644 --- a/modules/programs/swayr.nix +++ b/modules/programs/swayr.nix @@ -98,6 +98,7 @@ in systemd.target = mkOption { type = types.str; default = config.wayland.systemd.target; + defaultText = lib.literalExpression "config.wayland.systemd.target"; description = '' Systemd target to bind to. ''; diff --git a/modules/programs/vscode/default.nix b/modules/programs/vscode/default.nix index 98fd2a5f..ab15e56f 100644 --- a/modules/programs/vscode/default.nix +++ b/modules/programs/vscode/default.nix @@ -308,6 +308,7 @@ in mutableExtensionsDir = mkOption { type = types.bool; default = allProfilesExceptDefault == { }; + defaultText = lib.literalExpression "(removeAttrs config.programs.vscode.profiles [ \"default\" ]) == { }"; example = false; description = '' Whether extensions can be installed or updated manually diff --git a/modules/programs/yambar.nix b/modules/programs/yambar.nix index 48e6a844..34d3448e 100644 --- a/modules/programs/yambar.nix +++ b/modules/programs/yambar.nix @@ -51,6 +51,7 @@ in target = lib.mkOption { type = lib.types.str; default = config.wayland.systemd.target; + defaultText = lib.literalExpression "config.wayland.systemd.target"; example = "sway-session.target"; description = '' The systemd target that will automatically start the yambar service. diff --git a/modules/services/cliphist.nix b/modules/services/cliphist.nix index 9bdc4837..15cdfd58 100644 --- a/modules/services/cliphist.nix +++ b/modules/services/cliphist.nix @@ -53,6 +53,7 @@ in systemdTargets = lib.mkOption { type = with lib.types; either (listOf str) str; default = [ config.wayland.systemd.target ]; + defaultText = lib.literalExpression "[ config.wayland.systemd.target ]"; example = "sway-session.target"; description = '' The systemd targets that will automatically start the cliphist service. diff --git a/modules/services/hyprshell.nix b/modules/services/hyprshell.nix index b9940c1c..e38a9ebd 100644 --- a/modules/services/hyprshell.nix +++ b/modules/services/hyprshell.nix @@ -50,6 +50,7 @@ in target = mkOption { type = types.str; default = config.wayland.systemd.target; + defaultText = lib.literalExpression "config.wayland.systemd.target"; description = "The Systemd target that will start the hyprshell service"; }; diff --git a/modules/services/window-managers/hyprland.nix b/modules/services/window-managers/hyprland.nix index e41a6add..86bab625 100644 --- a/modules/services/window-managers/hyprland.nix +++ b/modules/services/window-managers/hyprland.nix @@ -250,8 +250,7 @@ in "$" "bezier" "name" - ] - ++ lib.optionals cfg.sourceFirst [ "source" ]; + ]; example = [ "$" "bezier" @@ -284,6 +283,8 @@ in shouldGenerate = cfg.systemd.enable || cfg.extraConfig != "" || cfg.settings != { } || cfg.plugins != [ ]; + importantPrefixes = cfg.importantPrefixes ++ lib.optional cfg.sourceFirst "source"; + pluginsToHyprconf = plugins: lib.hm.generators.toHyprconf { @@ -295,7 +296,7 @@ in in map (p: "hyprctl plugin load ${mkEntry p}") cfg.plugins; }; - inherit (cfg) importantPrefixes; + inherit importantPrefixes; }; in lib.mkIf shouldGenerate { @@ -305,7 +306,7 @@ in + lib.optionalString (cfg.settings != { }) ( lib.hm.generators.toHyprconf { attrs = cfg.settings; - inherit (cfg) importantPrefixes; + inherit importantPrefixes; } ) + lib.optionalString (cfg.extraConfig != "") cfg.extraConfig; diff --git a/modules/services/window-managers/i3-sway/lib/options.nix b/modules/services/window-managers/i3-sway/lib/options.nix index 534a4162..ce770c3c 100644 --- a/modules/services/window-managers/i3-sway/lib/options.nix +++ b/modules/services/window-managers/i3-sway/lib/options.nix @@ -581,6 +581,13 @@ in sway = if cfg.config.focus.forceWrapping then "yes" else "no"; } .${moduleName}; + defaultText = + literalExpression + { + i3 = ''if focus.forceWrapping then "force" else "yes"''; + sway = ''if focus.forceWrapping then "yes" else "no"''; + } + .${moduleName}; description = '' Whether the window focus commands automatically wrap around the edge of containers. diff --git a/modules/services/window-managers/i3-sway/sway.nix b/modules/services/window-managers/i3-sway/sway.nix index c3d8caff..36e4d9c6 100644 --- a/modules/services/window-managers/i3-sway/sway.nix +++ b/modules/services/window-managers/i3-sway/sway.nix @@ -262,6 +262,26 @@ let "Return" = "mode default"; }; }; + defaultText = lib.literalExpression '' + { + resize = { + # Binds arrow keys to resizing commands + ''${cfg.config.left}" = "resize shrink width 10 px"; + ''${cfg.config.down}" = "resize grow height 10 px"; + ''${cfg.config.up}" = "resize shrink height 10 px"; + ''${cfg.config.right}" = "resize grow width 10 px"; + + "Left" = "resize shrink width 10 px"; + "Down" = "resize grow height 10 px"; + "Up" = "resize shrink height 10 px"; + "Right" = "resize grow width 10 px"; + + # Exit resize mode + "Escape" = "mode default"; + "Return" = "mode default"; + }; + } + ''; description = '' An attribute set that defines binding modes and keybindings inside them diff --git a/modules/services/wlsunset.nix b/modules/services/wlsunset.nix index 2eb59c6c..4bdc9a8f 100644 --- a/modules/services/wlsunset.nix +++ b/modules/services/wlsunset.nix @@ -99,6 +99,7 @@ in systemdTarget = mkOption { type = with types; str; default = config.wayland.systemd.target; + defaultText = lib.literalExpression "config.wayland.systemd.target"; description = '' Systemd target to bind to. '';