From 5af1b9a0f193ab6138b89a8e0af8763c21bbf491 Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sat, 25 Jan 2025 23:16:15 +0100 Subject: [PATCH] treewide: standardize shell integration options Standardize all 'programs..enableIntegration' options with the following new functions: - lib.hm.shell.mkBashIntegrationOption - lib.hm.shell.mkFishIntegrationOption - lib.hm.shell.mkIonIntegrationOption - lib.hm.shell.mkNushellIntegrationOption - lib.hm.shell.mkZshIntegrationOption These functions should default to their corresponding global option: - home.shell.enableBashIntegration - home.shell.enableFishIntegration - home.shell.enableIonIntegration - home.shell.enableNushellIntegration - home.shell.enableZshIntegration All these global options default to the 'home.shell.enableShellIntegration' value. This hierarchy standardizes the shell integration and increases end-user flexibility. BREAKING CHANGE: The following inconsistent default values change from 'false' to 'true': - programs.zellij.enableBashIntegration - programs.zellij.enableFishIntegration - programs.zellij.enableZshIntegration Link: https://github.com/nix-community/home-manager/pull/6358 Co-authored-by: Robert Helgesson --- modules/lib/shell.nix | 24 ++++++++++++++- modules/misc/news.nix | 16 ++++++++++ modules/misc/shell.nix | 43 ++++++++++++++++++++++++++ modules/modules.nix | 1 + modules/programs/atuin.nix | 45 +++++++++------------------ modules/programs/autojump.nix | 27 ++++------------ modules/programs/broot.nix | 36 +++++----------------- modules/programs/carapace.nix | 20 +++++------- modules/programs/dircolors.nix | 27 ++++------------ modules/programs/direnv.nix | 48 +++++++++++------------------ modules/programs/eww.nix | 15 ++++----- modules/programs/eza.nix | 23 ++++++-------- modules/programs/fzf.nix | 27 ++++------------ modules/programs/ghostty.nix | 44 +++++++++++++------------- modules/programs/granted.nix | 9 ++---- modules/programs/hstr.nix | 10 +++--- modules/programs/keychain.nix | 36 +++++----------------- modules/programs/kitty.nix | 27 ++++++++-------- modules/programs/mcfly.nix | 27 ++++------------ modules/programs/mise.nix | 15 ++++----- modules/programs/navi.nix | 15 ++++----- modules/programs/nix-index.nix | 15 ++++----- modules/programs/nix-your-shell.nix | 15 ++++----- modules/programs/oh-my-posh.nix | 36 +++++----------------- modules/programs/opam.nix | 27 ++++------------ modules/programs/pay-respects.nix | 20 +++++------- modules/programs/pazi.nix | 27 ++++------------ modules/programs/pyenv.nix | 27 ++++------------ modules/programs/rbenv.nix | 15 ++++----- modules/programs/scmpuff.nix | 27 ++++------------ modules/programs/skim.nix | 27 ++++------------ modules/programs/starship.nix | 25 ++++++--------- modules/programs/thefuck.nix | 32 +++++-------------- modules/programs/watson.nix | 15 ++++----- modules/programs/wezterm.nix | 10 +++--- modules/programs/yazi.nix | 20 +++++------- modules/programs/z-lua.nix | 27 ++++------------ modules/programs/zellij.nix | 15 ++++----- modules/programs/zoxide.nix | 36 +++++----------------- modules/services/gpg-agent.nix | 20 +++++------- 40 files changed, 362 insertions(+), 609 deletions(-) create mode 100644 modules/misc/shell.nix diff --git a/modules/lib/shell.nix b/modules/lib/shell.nix index 5e5743f51..ae30e0b0f 100644 --- a/modules/lib/shell.nix +++ b/modules/lib/shell.nix @@ -1,6 +1,22 @@ { lib }: -rec { +let + + mkShellIntegrationOption = name: + { config, baseName ? name, extraDescription ? "" }: + let attrName = "enable${baseName}Integration"; + in lib.mkOption { + default = config.home.shell.${attrName}; + defaultText = lib.literalMD "[](#opt-home.shell.${attrName})"; + example = false; + description = "Whether to enable ${name} integration.${ + lib.optionalString (extraDescription != "") + ("\n\n" + extraDescription) + }"; + type = lib.types.bool; + }; + +in rec { # Produces a Bourne shell like variable export statement. export = n: v: ''export ${n}="${toString v}"''; @@ -8,4 +24,10 @@ rec { # assignment, this function produces a string containing an export # statement for each set entry. exportAll = vars: lib.concatStringsSep "\n" (lib.mapAttrsToList export vars); + + mkBashIntegrationOption = mkShellIntegrationOption "Bash"; + mkFishIntegrationOption = mkShellIntegrationOption "Fish"; + mkIonIntegrationOption = mkShellIntegrationOption "Ion"; + mkNushellIntegrationOption = mkShellIntegrationOption "Nushell"; + mkZshIntegrationOption = mkShellIntegrationOption "Zsh"; } diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 1eca33626..c34fbcba8 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -2018,6 +2018,22 @@ in { systems. ''; } + + { + time = "2025-02-07T22:31:45+00:00"; + message = '' + All 'programs..enableIntegration' values now default + to the new 'home.shell.enableIntegration' options, which + inherit from the new the 'home.shell.enableShellIntegration' option. + + The following inconsistent default values change from 'false' to + 'true': + + - programs.zellij.enableBashIntegration + - programs.zellij.enableFishIntegration + - programs.zellij.enableZshIntegration + ''; + } ]; }; } diff --git a/modules/misc/shell.nix b/modules/misc/shell.nix new file mode 100644 index 000000000..7ef8bbfc7 --- /dev/null +++ b/modules/misc/shell.nix @@ -0,0 +1,43 @@ +{ config, lib, ... }: + +{ + options.home.shell = { + enableShellIntegration = lib.mkOption { + type = lib.types.bool; + default = true; + example = false; + description = '' + Whether to globally enable shell integration for all supported shells. + + Individual shell integrations can be overridden with their respective + `shell.enableIntegration` option. For example, the following + declaration globally disables shell integration for Bash: + + ```nix + home.shell.enableBashIntegration = false; + ``` + ''; + }; + + enableBashIntegration = lib.hm.shell.mkBashIntegrationOption { + inherit config; + baseName = "Shell"; + }; + enableFishIntegration = lib.hm.shell.mkFishIntegrationOption { + inherit config; + baseName = "Shell"; + }; + enableIonIntegration = lib.hm.shell.mkIonIntegrationOption { + inherit config; + baseName = "Shell"; + }; + enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption { + inherit config; + baseName = "Shell"; + }; + enableZshIntegration = lib.hm.shell.mkZshIntegrationOption { + inherit config; + baseName = "Shell"; + }; + }; +} diff --git a/modules/modules.nix b/modules/modules.nix index 074e719d2..aa1d2e744 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -36,6 +36,7 @@ let ./misc/pam.nix ./misc/qt.nix ./misc/qt/kconfig.nix + ./misc/shell.nix ./misc/specialisation.nix ./misc/submodule-support.nix ./misc/tmpfiles.nix diff --git a/modules/programs/atuin.nix b/modules/programs/atuin.nix index 9160edd3f..50e088b12 100644 --- a/modules/programs/atuin.nix +++ b/modules/programs/atuin.nix @@ -23,33 +23,26 @@ in { description = "The package to use for atuin."; }; - enableBashIntegration = mkOption { - type = types.bool; - default = true; - description = '' - Whether to enable Atuin's Bash integration. This will bind - `ctrl-r` to open the Atuin history. - ''; + enableBashIntegration = lib.hm.shell.mkBashIntegrationOption { + inherit config; + extraDescription = + "If enabled, this will bind `ctrl-r` to open the Atuin history."; }; - enableZshIntegration = mkOption { - type = types.bool; - default = true; - description = '' - Whether to enable Atuin's Zsh integration. - - If enabled, this will bind `ctrl-r` and the up-arrow - key to open the Atuin history. - ''; + enableFishIntegration = lib.hm.shell.mkFishIntegrationOption { + inherit config; + extraDescription = + "If enabled, this will bind the up-arrow key to open the Atuin history."; }; - enableFishIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Atuin's Fish integration. + enableNushellIntegration = + lib.hm.shell.mkNushellIntegrationOption { inherit config; }; - If enabled, this will bind the up-arrow key to open the Atuin history. + enableZshIntegration = lib.hm.shell.mkZshIntegrationOption { + inherit config; + extraDescription = '' + If enabled, this will bind `ctrl-r` and the up-arrow key to open the + Atuin history. ''; }; @@ -89,14 +82,6 @@ in { ''; }; - enableNushellIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Nushell integration. - ''; - }; - daemon = { enable = mkEnableOption "Atuin daemon"; diff --git a/modules/programs/autojump.nix b/modules/programs/autojump.nix index e8bf6b437..3177001c8 100644 --- a/modules/programs/autojump.nix +++ b/modules/programs/autojump.nix @@ -13,29 +13,14 @@ in { options.programs.autojump = { enable = mkEnableOption "autojump"; - enableBashIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Bash integration. - ''; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Fish integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; config = mkIf cfg.enable { diff --git a/modules/programs/broot.nix b/modules/programs/broot.nix index 7daba09f5..c19534f1a 100644 --- a/modules/programs/broot.nix +++ b/modules/programs/broot.nix @@ -154,37 +154,17 @@ in { options.programs.broot = { enable = mkEnableOption "Broot, a better way to navigate directories"; - enableBashIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Bash integration. - ''; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Fish integration. - ''; - }; + enableNushellIntegration = + lib.hm.shell.mkNushellIntegrationOption { inherit config; }; - enableNushellIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Nushell integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; package = mkOption { type = types.package; diff --git a/modules/programs/carapace.nix b/modules/programs/carapace.nix index c31e2feed..09cc55635 100644 --- a/modules/programs/carapace.nix +++ b/modules/programs/carapace.nix @@ -16,21 +16,17 @@ in { package = mkPackageOption pkgs "carapace" { }; - enableBashIntegration = mkEnableOption "Bash integration" // { - default = true; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableNushellIntegration = + lib.hm.shell.mkNushellIntegrationOption { inherit config; }; - enableNushellIntegration = mkEnableOption "Nushell integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; config = mkIf cfg.enable { diff --git a/modules/programs/dircolors.nix b/modules/programs/dircolors.nix index de4610893..91aaff41f 100644 --- a/modules/programs/dircolors.nix +++ b/modules/programs/dircolors.nix @@ -19,29 +19,14 @@ in { ''; }; - enableBashIntegration = mkOption { - type = types.bool; - default = true; - description = '' - Whether to enable Bash integration. - ''; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableFishIntegration = mkOption { - type = types.bool; - default = true; - description = '' - Whether to enable Fish integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableZshIntegration = mkOption { - type = types.bool; - default = true; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; settings = mkOption { type = with types; attrsOf str; diff --git a/modules/programs/direnv.nix b/modules/programs/direnv.nix index b0b3baee4..a387a4bc7 100644 --- a/modules/programs/direnv.nix +++ b/modules/programs/direnv.nix @@ -48,44 +48,32 @@ in { ''; }; - enableBashIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Bash integration. - ''; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = lib.hm.shell.mkFishIntegrationOption { + inherit config; + extraDescription = '' + Note, enabling the direnv module will always active its functionality + for Fish since the direnv package automatically gets loaded in Fish. + If this is not the case try adding - enableFishIntegration = mkOption { - default = true; - type = types.bool; - readOnly = true; - description = '' - Whether to enable Fish integration. Note, enabling the direnv module - will always active its functionality for Fish since the direnv package - automatically gets loaded in Fish. If this is not the case try adding ```nix - environment.pathsToLink = [ "/share/fish" ]; + environment.pathsToLink = [ "/share/fish" ]; ``` + to the system configuration. ''; + } // { + default = true; + readOnly = true; }; - enableNushellIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Nushell integration. - ''; - }; + enableNushellIntegration = + lib.hm.shell.mkNushellIntegrationOption { inherit config; }; + + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; nix-direnv = { enable = mkEnableOption '' diff --git a/modules/programs/eww.nix b/modules/programs/eww.nix index 75a109226..71432590d 100644 --- a/modules/programs/eww.nix +++ b/modules/programs/eww.nix @@ -32,17 +32,14 @@ in { ''; }; - enableBashIntegration = mkEnableOption "Bash integration" // { - default = true; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; config = mkIf cfg.enable { diff --git a/modules/programs/eza.nix b/modules/programs/eza.nix index f35912b8c..55a4a1001 100644 --- a/modules/programs/eza.nix +++ b/modules/programs/eza.nix @@ -21,23 +21,20 @@ with lib; options.programs.eza = { enable = mkEnableOption "eza, a modern replacement for {command}`ls`"; - enableBashIntegration = mkEnableOption "Bash integration" // { - default = true; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableIonIntegration = + lib.hm.shell.mkIonIntegrationOption { inherit config; }; - enableIonIntegration = mkEnableOption "Ion integration" // { - default = true; - }; + enableNushellIntegration = + lib.hm.shell.mkNushellIntegrationOption { inherit config; }; - enableNushellIntegration = mkEnableOption "Nushell integration"; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; extraOptions = mkOption { type = types.listOf types.str; diff --git a/modules/programs/fzf.nix b/modules/programs/fzf.nix index 85ada14d6..6f45682ca 100644 --- a/modules/programs/fzf.nix +++ b/modules/programs/fzf.nix @@ -158,29 +158,14 @@ in { }; }; - enableBashIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Bash integration. - ''; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Fish integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; config = mkIf cfg.enable { diff --git a/modules/programs/ghostty.nix b/modules/programs/ghostty.nix index 3c2f88f86..c0fe86208 100644 --- a/modules/programs/ghostty.nix +++ b/modules/programs/ghostty.nix @@ -10,7 +10,22 @@ let in { meta.maintainers = with lib.maintainers; [ HeitorAugustoLN khaneliman ]; - options.programs.ghostty = { + options.programs.ghostty = let + mkShellIntegrationOption = option: + option // { + description = '' + ${option.description} + + This ensures that shell integration works in more scenarios, such as + switching shells within Ghostty. But it is not needed to have shell + integration. + + See + + for more information. + ''; + }; + in { enable = lib.mkEnableOption "Ghostty"; package = lib.mkPackageOption pkgs "ghostty" { @@ -91,29 +106,14 @@ in { lib.literalMD "`true` if programs.ghostty.package is not null"; }; - enableBashIntegration = lib.mkEnableOption '' - bash shell integration. + enableBashIntegration = mkShellIntegrationOption + (lib.hm.shell.mkBashIntegrationOption { inherit config; }); - This is ensures that shell integration works in more scenarios, such as switching shells within Ghostty. - But it is not needed to have shell integration. - See for more information - ''; + enableFishIntegration = mkShellIntegrationOption + (lib.hm.shell.mkFishIntegrationOption { inherit config; }); - enableFishIntegration = lib.mkEnableOption '' - fish shell integration. - - This is ensures that shell integration works in more scenarios, such as switching shells within Ghostty. - But it is not needed to have shell integration. - See for more information - ''; - - enableZshIntegration = lib.mkEnableOption '' - zsh shell integration. - - This is ensures that shell integration works in more scenarios, such as switching shells within Ghostty. - But it is not needed to have shell integration. - See for more information - ''; + enableZshIntegration = mkShellIntegrationOption + (lib.hm.shell.mkZshIntegrationOption { inherit config; }); }; config = lib.mkIf cfg.enable (lib.mkMerge [ diff --git a/modules/programs/granted.nix b/modules/programs/granted.nix index 93cdb97df..d3a7e5e00 100644 --- a/modules/programs/granted.nix +++ b/modules/programs/granted.nix @@ -13,13 +13,8 @@ in { options.programs.granted = { enable = mkEnableOption "granted"; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; config = mkIf cfg.enable { diff --git a/modules/programs/hstr.nix b/modules/programs/hstr.nix index e85832174..6dc2c0a33 100644 --- a/modules/programs/hstr.nix +++ b/modules/programs/hstr.nix @@ -16,13 +16,11 @@ in { package = mkPackageOption pkgs "hstr" { }; - enableBashIntegration = mkEnableOption "Bash integration" // { - default = true; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; config = mkIf cfg.enable { diff --git a/modules/programs/keychain.nix b/modules/programs/keychain.nix index 4aeef4132..c428f40cf 100644 --- a/modules/programs/keychain.nix +++ b/modules/programs/keychain.nix @@ -63,37 +63,17 @@ in { ''; }; - enableBashIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Bash integration. - ''; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableFishIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Fish integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableNushellIntegration = + lib.hm.shell.mkNushellIntegrationOption { inherit config; }; - enableNushellIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Nushell integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; enableXsessionIntegration = mkOption { default = true; diff --git a/modules/programs/kitty.nix b/modules/programs/kitty.nix index 53f7c9fc1..ea528b24e 100644 --- a/modules/programs/kitty.nix +++ b/modules/programs/kitty.nix @@ -50,13 +50,14 @@ let ''; }; - shellIntegrationDefaultOpt = { - default = - !(lib.elem "disabled" (lib.splitString " " cfg.shellIntegration.mode)); - defaultText = literalExpression '' - !(elem "disabled" (splitString " " config.programs.kitty.shellIntegration.mode)) - ''; - }; + mkShellIntegrationOption = option: + option // { + default = + !(lib.elem "disabled" (lib.splitString " " cfg.shellIntegration.mode)); + defaultText = literalExpression '' + !(elem "disabled" (splitString " " config.programs.kitty.shellIntegration.mode)) + ''; + }; in { imports = [ (lib.mkChangedOptionModule [ "programs" "kitty" "theme" ] [ @@ -184,14 +185,14 @@ in { ''; }; - enableBashIntegration = mkEnableOption "Kitty Bash integration" - // shellIntegrationDefaultOpt; + enableBashIntegration = mkShellIntegrationOption + (lib.hm.shell.mkBashIntegrationOption { inherit config; }); - enableFishIntegration = mkEnableOption "Kitty fish integration" - // shellIntegrationDefaultOpt; + enableFishIntegration = mkShellIntegrationOption + (lib.hm.shell.mkFishIntegrationOption { inherit config; }); - enableZshIntegration = mkEnableOption "Kitty Z Shell integration" - // shellIntegrationDefaultOpt; + enableZshIntegration = mkShellIntegrationOption + (lib.hm.shell.mkZshIntegrationOption { inherit config; }); }; extraConfig = mkOption { diff --git a/modules/programs/mcfly.nix b/modules/programs/mcfly.nix index d0dddba21..cf115129d 100644 --- a/modules/programs/mcfly.nix +++ b/modules/programs/mcfly.nix @@ -109,29 +109,14 @@ in { ''; }; - enableBashIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Bash integration. - ''; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Fish integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; config = mkIf cfg.enable (mkMerge [ diff --git a/modules/programs/mise.nix b/modules/programs/mise.nix index 404f1bf9c..e0d1b1c8b 100644 --- a/modules/programs/mise.nix +++ b/modules/programs/mise.nix @@ -30,17 +30,14 @@ in { package = mkPackageOption pkgs "mise" { }; - enableBashIntegration = mkEnableOption "Bash Integration" // { - default = true; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkEnableOption "Zsh Integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkEnableOption "Fish Integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; globalConfig = mkOption { type = tomlFormat.type; diff --git a/modules/programs/navi.nix b/modules/programs/navi.nix index aff50b5c7..23fb04864 100644 --- a/modules/programs/navi.nix +++ b/modules/programs/navi.nix @@ -47,17 +47,14 @@ in { ''; }; - enableBashIntegration = mkEnableOption "Bash integration" // { - default = true; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; config = mkIf cfg.enable { diff --git a/modules/programs/nix-index.nix b/modules/programs/nix-index.nix index 746909d5a..f483cd2bc 100644 --- a/modules/programs/nix-index.nix +++ b/modules/programs/nix-index.nix @@ -14,17 +14,14 @@ in { description = "Package providing the {command}`nix-index` tool."; }; - enableBashIntegration = mkEnableOption "Bash integration" // { - default = true; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; config = lib.mkIf cfg.enable { diff --git a/modules/programs/nix-your-shell.nix b/modules/programs/nix-your-shell.nix index 20b5fd19e..adace4e15 100644 --- a/modules/programs/nix-your-shell.nix +++ b/modules/programs/nix-your-shell.nix @@ -16,17 +16,14 @@ in { package = mkPackageOption pkgs "nix-your-shell" { }; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableNushellIntegration = mkEnableOption "Nushell integration" // { - default = true; - }; + enableNushellIntegration = + lib.hm.shell.mkNushellIntegrationOption { inherit config; }; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; config = mkIf cfg.enable { diff --git a/modules/programs/oh-my-posh.nix b/modules/programs/oh-my-posh.nix index 8c46a1c69..be406e662 100644 --- a/modules/programs/oh-my-posh.nix +++ b/modules/programs/oh-my-posh.nix @@ -47,37 +47,17 @@ in { ''; }; - enableBashIntegration = mkOption { - type = types.bool; - default = true; - description = '' - Whether to enable Bash integration. - ''; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkOption { - type = types.bool; - default = true; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkOption { - type = types.bool; - default = true; - description = '' - Whether to enable Fish integration. - ''; - }; + enableNushellIntegration = + lib.hm.shell.mkNushellIntegrationOption { inherit config; }; - enableNushellIntegration = mkOption { - type = types.bool; - default = true; - description = '' - Whether to enable Nushell integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; config = mkIf cfg.enable { diff --git a/modules/programs/opam.nix b/modules/programs/opam.nix index 34338514a..6027737cd 100644 --- a/modules/programs/opam.nix +++ b/modules/programs/opam.nix @@ -19,29 +19,14 @@ in { description = "Opam package to install."; }; - enableBashIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Bash integration. - ''; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Fish integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; config = mkIf cfg.enable { diff --git a/modules/programs/pay-respects.nix b/modules/programs/pay-respects.nix index ea47bee4c..8802ad25e 100644 --- a/modules/programs/pay-respects.nix +++ b/modules/programs/pay-respects.nix @@ -12,21 +12,17 @@ in { package = mkPackageOption pkgs "pay-respects" { }; - enableBashIntegration = mkEnableOption "Bash integration" // { - default = true; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableNushellIntegration = + lib.hm.shell.mkNushellIntegrationOption { inherit config; }; - enableNushellIntegration = mkEnableOption "Nushell integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; config = mkIf cfg.enable { diff --git a/modules/programs/pazi.nix b/modules/programs/pazi.nix index 9e603df23..848dfa309 100644 --- a/modules/programs/pazi.nix +++ b/modules/programs/pazi.nix @@ -12,29 +12,14 @@ in { options.programs.pazi = { enable = mkEnableOption "pazi"; - enableBashIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Bash integration. - ''; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Fish integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; config = mkIf cfg.enable { diff --git a/modules/programs/pyenv.nix b/modules/programs/pyenv.nix index c2273c676..1ff1f2832 100644 --- a/modules/programs/pyenv.nix +++ b/modules/programs/pyenv.nix @@ -19,29 +19,14 @@ in { description = "The package to use for pyenv."; }; - enableBashIntegration = lib.mkOption { - type = lib.types.bool; - default = true; - description = '' - Whether to enable pyenv's Bash integration. - ''; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = lib.mkOption { - type = lib.types.bool; - default = true; - description = '' - Whether to enable pyenv's Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = lib.mkOption { - type = lib.types.bool; - default = true; - description = '' - Whether to enable pyenv's Fish integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; rootDirectory = lib.mkOption { type = lib.types.path; diff --git a/modules/programs/rbenv.nix b/modules/programs/rbenv.nix index e740c5602..11b48abf4 100644 --- a/modules/programs/rbenv.nix +++ b/modules/programs/rbenv.nix @@ -55,17 +55,14 @@ in { ''; }; - enableBashIntegration = mkEnableOption "Bash integration" // { - default = true; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; config = mkIf cfg.enable { diff --git a/modules/programs/scmpuff.nix b/modules/programs/scmpuff.nix index a85ae8d9c..f9ff922a9 100644 --- a/modules/programs/scmpuff.nix +++ b/modules/programs/scmpuff.nix @@ -16,29 +16,14 @@ in { description = "Package providing the {command}`scmpuff` tool."; }; - enableBashIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Bash integration. - ''; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable fish integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; enableAliases = mkOption { default = true; diff --git a/modules/programs/skim.nix b/modules/programs/skim.nix index 2bb17d1b9..0f47a00bf 100644 --- a/modules/programs/skim.nix +++ b/modules/programs/skim.nix @@ -83,29 +83,14 @@ in { ''; }; - enableBashIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Bash integration. - ''; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Fish integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; config = mkIf cfg.enable { diff --git a/modules/programs/starship.nix b/modules/programs/starship.nix index 654c43fca..bb1c87b9c 100644 --- a/modules/programs/starship.nix +++ b/modules/programs/starship.nix @@ -53,25 +53,20 @@ in { ''; }; - enableBashIntegration = mkEnableOption "Bash integration" // { - default = true; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableIonIntegration = + lib.hm.shell.mkIonIntegrationOption { inherit config; }; - enableIonIntegration = mkEnableOption "Ion integration" // { - default = true; - }; + enableNushellIntegration = + lib.hm.shell.mkNushellIntegrationOption { inherit config; }; - enableNushellIntegration = mkEnableOption "Nushell integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; enableInteractive = mkOption { type = types.bool; diff --git a/modules/programs/thefuck.nix b/modules/programs/thefuck.nix index ab56ea016..79b1f9462 100644 --- a/modules/programs/thefuck.nix +++ b/modules/programs/thefuck.nix @@ -13,33 +13,17 @@ with lib; enableInstantMode = mkEnableOption "thefuck's experimental instant mode"; - enableBashIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Bash integration. - ''; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableNushellIntegration = + lib.hm.shell.mkNushellIntegrationOption { inherit config; }; - enableNushellIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Nushell integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; config = let diff --git a/modules/programs/watson.nix b/modules/programs/watson.nix index c842c519a..1f9864559 100644 --- a/modules/programs/watson.nix +++ b/modules/programs/watson.nix @@ -26,17 +26,14 @@ in { description = "Package providing the {command}`watson`."; }; - enableBashIntegration = mkEnableOption "watson's bash integration" // { - default = true; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkEnableOption "watson's zsh integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkEnableOption "watson's fish integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; settings = mkOption { type = iniFormat.type; diff --git a/modules/programs/wezterm.nix b/modules/programs/wezterm.nix index f5c4c3392..c1478d64a 100644 --- a/modules/programs/wezterm.nix +++ b/modules/programs/wezterm.nix @@ -82,13 +82,11 @@ in { ''; }; - enableBashIntegration = mkEnableOption "WezTerm's Bash integration" // { - default = true; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkEnableOption "WezTerm's Zsh integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; config = mkIf cfg.enable { diff --git a/modules/programs/yazi.nix b/modules/programs/yazi.nix index 27737f86a..946691f6b 100644 --- a/modules/programs/yazi.nix +++ b/modules/programs/yazi.nix @@ -54,21 +54,17 @@ in { ''; }; - enableBashIntegration = mkEnableOption "Bash integration" // { - default = true; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableNushellIntegration = + lib.hm.shell.mkNushellIntegrationOption { inherit config; }; - enableNushellIntegration = mkEnableOption "Nushell integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; keymap = mkOption { type = tomlFormat.type; diff --git a/modules/programs/z-lua.nix b/modules/programs/z-lua.nix index 74dee31dc..4164aa394 100644 --- a/modules/programs/z-lua.nix +++ b/modules/programs/z-lua.nix @@ -29,29 +29,14 @@ in { ''; }; - enableBashIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Bash integration. - ''; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Fish integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; enableAliases = mkOption { default = false; diff --git a/modules/programs/zellij.nix b/modules/programs/zellij.nix index 0906a028d..77027b5df 100644 --- a/modules/programs/zellij.nix +++ b/modules/programs/zellij.nix @@ -41,17 +41,14 @@ in { ''; }; - enableBashIntegration = mkEnableOption "Bash integration" // { - default = false; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = false; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = false; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; config = mkIf cfg.enable { diff --git a/modules/programs/zoxide.nix b/modules/programs/zoxide.nix index f5e258af9..23a18a357 100644 --- a/modules/programs/zoxide.nix +++ b/modules/programs/zoxide.nix @@ -32,37 +32,17 @@ in { ''; }; - enableBashIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Bash integration. - ''; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Fish integration. - ''; - }; + enableNushellIntegration = + lib.hm.shell.mkNushellIntegrationOption { inherit config; }; - enableNushellIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Nushell integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; config = mkIf cfg.enable { diff --git a/modules/services/gpg-agent.nix b/modules/services/gpg-agent.nix index 786a9f2e9..f32d85af3 100644 --- a/modules/services/gpg-agent.nix +++ b/modules/services/gpg-agent.nix @@ -260,21 +260,17 @@ in { ''; }; - enableBashIntegration = mkEnableOption "Bash integration" // { - default = true; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableNushellIntegration = + lib.hm.shell.mkNushellIntegrationOption { inherit config; }; - enableNushellIntegration = mkEnableOption "Nushell integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; };