diff --git a/modules/lib/shell.nix b/modules/lib/shell.nix index 5e5743f51..2614a6fac 100644 --- a/modules/lib/shell.nix +++ b/modules/lib/shell.nix @@ -1,6 +1,12 @@ { lib }: -rec { +let + mkShellIntegrationOption = name: default: + lib.mkEnableOption "${name} integration" // { + inherit default; + example = !default; + }; +in rec { # Produces a Bourne shell like variable export statement. export = n: v: ''export ${n}="${toString v}"''; @@ -8,4 +14,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 c578d2378..155ba809c 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -1972,6 +1972,22 @@ in { 'yazi' alias. ''; } + + { + time = "2025-01-25T22:15:57+00:00"; + message = '' + All 'programs..enableIntegration' values now default + to the new 'shell.enableIntegration' options, which inherit + from the new the 'shell.enableShellIntegration' option. + + This modifies the following inconsistent default values 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..9255e70db --- /dev/null +++ b/modules/misc/shell.nix @@ -0,0 +1,28 @@ +{ config, lib, ... }: { + options.shell = let enable = config.shell.enableShellIntegration; + in { + enableShellIntegration = lib.mkOption { + type = lib.types.bool; + default = true; + example = false; + + description = '' + Whether to 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 + config.shell.enableBashIntegration = false; + ``` + ''; + }; + + enableBashIntegration = lib.hm.shell.mkBashIntegrationOption enable; + enableFishIntegration = lib.hm.shell.mkFishIntegrationOption enable; + enableIonIntegration = lib.hm.shell.mkIonIntegrationOption enable; + enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption enable; + enableZshIntegration = lib.hm.shell.mkZshIntegrationOption enable; + }; +} diff --git a/modules/modules.nix b/modules/modules.nix index d20300d1a..51d5a7f9e 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 b57cc142a..cae434833 100644 --- a/modules/programs/atuin.nix +++ b/modules/programs/atuin.nix @@ -13,7 +13,16 @@ let in { meta.maintainers = [ maintainers.hawkw maintainers.water-sucks ]; - options.programs.atuin = { + options.programs.atuin = let + mkShellIntegrationOption = option: description: + option // { + description = '' + ${option.description} + + ${description} + ''; + }; + in { enable = mkEnableOption "atuin"; package = mkOption { @@ -23,35 +32,19 @@ 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 = mkShellIntegrationOption + (lib.hm.shell.mkBashIntegrationOption config.shell.enableBashIntegration) + "If enabled, this will bind `ctrl-r` to open the Atuin history."; + + enableFishIntegration = mkShellIntegrationOption + (lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration) + "If enabled, this will bind the up-arrow key to open the Atuin history."; + + enableZshIntegration = mkShellIntegrationOption + (lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration) '' + If enabled, this will bind `ctrl-r` and the up-arrow key 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 = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Atuin's Fish integration. - - If enabled, this will bind the up-arrow key to open the Atuin history. - ''; - }; flags = mkOption { default = [ ]; diff --git a/modules/programs/autojump.nix b/modules/programs/autojump.nix index e8bf6b437..441fe1744 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 config.shell.enableBashIntegration; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Fish integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; }; config = mkIf cfg.enable { diff --git a/modules/programs/broot.nix b/modules/programs/broot.nix index c1ce94776..9d8860b02 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 config.shell.enableBashIntegration; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Fish integration. - ''; - }; + enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption + config.shell.enableNushellIntegration; - enableNushellIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Nushell integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; package = mkOption { type = types.package; diff --git a/modules/programs/carapace.nix b/modules/programs/carapace.nix index c31e2feed..99bbbc1f5 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 config.shell.enableBashIntegration; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption + config.shell.enableNushellIntegration; - enableNushellIntegration = mkEnableOption "Nushell integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; }; config = mkIf cfg.enable { diff --git a/modules/programs/dircolors.nix b/modules/programs/dircolors.nix index de4610893..64ae1c39e 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 config.shell.enableBashIntegration; - enableFishIntegration = mkOption { - type = types.bool; - default = true; - description = '' - Whether to enable Fish integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableZshIntegration = mkOption { - type = types.bool; - default = true; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; settings = mkOption { type = with types; attrsOf str; diff --git a/modules/programs/direnv.nix b/modules/programs/direnv.nix index 37899c4a2..2a5426c4a 100644 --- a/modules/programs/direnv.nix +++ b/modules/programs/direnv.nix @@ -48,44 +48,34 @@ in { ''; }; - enableBashIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Bash integration. - ''; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption config.shell.enableBashIntegration; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = + let option = lib.hm.shell.mkFishIntegrationOption true; + in option // { + description = '' + ${option.description} - 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" ]; - ``` - to the system configuration. - ''; - }; + 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: - enableNushellIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Nushell integration. - ''; - }; + ```nix + environment.pathsToLink = [ "/share/fish" ]; + ``` + + to the system configuration. + ''; + + readOnly = true; + }; + + enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption + config.shell.enableNushellIntegration; + + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; nix-direnv = { enable = mkEnableOption '' diff --git a/modules/programs/eww.nix b/modules/programs/eww.nix index 75a109226..fb9dad568 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 config.shell.enableBashIntegration; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; }; config = mkIf cfg.enable { diff --git a/modules/programs/eza.nix b/modules/programs/eza.nix index f35912b8c..3a90e9883 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 config.shell.enableBashIntegration; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableIonIntegration = + lib.hm.shell.mkIonIntegrationOption config.shell.enableIonIntegration; - enableIonIntegration = mkEnableOption "Ion integration" // { - default = true; - }; + enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption + config.shell.enableNushellIntegration; - enableNushellIntegration = mkEnableOption "Nushell integration"; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; extraOptions = mkOption { type = types.listOf types.str; diff --git a/modules/programs/fzf.nix b/modules/programs/fzf.nix index 31df95de6..4bd83472b 100644 --- a/modules/programs/fzf.nix +++ b/modules/programs/fzf.nix @@ -156,29 +156,14 @@ in { }; }; - enableBashIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Bash integration. - ''; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption config.shell.enableBashIntegration; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Fish integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; }; config = mkIf cfg.enable { diff --git a/modules/programs/ghostty.nix b/modules/programs/ghostty.nix index 06b138c61..0ca7dacef 100644 --- a/modules/programs/ghostty.nix +++ b/modules/programs/ghostty.nix @@ -10,7 +10,22 @@ let in { meta.maintainers = [ lib.maintainers.HeitorAugustoLN ]; - 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" { }; @@ -85,29 +100,14 @@ in { default = true; }; - enableBashIntegration = lib.mkEnableOption '' - bash shell integration. + enableBashIntegration = mkShellIntegrationOption + (lib.hm.shell.mkBashIntegrationOption config.shell.enableBashIntegration); - 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 config.shell.enableFishIntegration); - 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 config.shell.enableZshIntegration); }; config = lib.mkIf cfg.enable (lib.mkMerge [ diff --git a/modules/programs/granted.nix b/modules/programs/granted.nix index 93cdb97df..4088774c6 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 config.shell.enableZshIntegration; }; config = mkIf cfg.enable { diff --git a/modules/programs/hstr.nix b/modules/programs/hstr.nix index e85832174..ef1ec74fd 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 config.shell.enableBashIntegration; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; }; config = mkIf cfg.enable { diff --git a/modules/programs/keychain.nix b/modules/programs/keychain.nix index 4aeef4132..0de38de15 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 config.shell.enableBashIntegration; - enableFishIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Fish integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption + config.shell.enableNushellIntegration; - enableNushellIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Nushell integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; enableXsessionIntegration = mkOption { default = true; diff --git a/modules/programs/kitty.nix b/modules/programs/kitty.nix index 9854fe69c..e8be3a3e5 100644 --- a/modules/programs/kitty.nix +++ b/modules/programs/kitty.nix @@ -49,12 +49,12 @@ let ''; }; - shellIntegrationDefaultOpt = { - default = !(elem "disabled" (splitString " " cfg.shellIntegration.mode)); - defaultText = literalExpression '' - !(elem "disabled" (splitString " " config.programs.kitty.shellIntegration.mode)) - ''; - }; + mkShellIntegrationOption = option: + option (!(elem "disabled" (splitString " " cfg.shellIntegration.mode))) // { + defaultText = literalExpression '' + !(elem "disabled" (splitString " " config.programs.kitty.shellIntegration.mode)) + ''; + }; in { imports = [ (mkChangedOptionModule [ "programs" "kitty" "theme" ] [ @@ -179,14 +179,14 @@ in { ''; }; - enableBashIntegration = mkEnableOption "Kitty Bash integration" - // shellIntegrationDefaultOpt; + enableBashIntegration = + mkShellIntegrationOption lib.hm.shell.mkBashIntegrationOption; - enableFishIntegration = mkEnableOption "Kitty fish integration" - // shellIntegrationDefaultOpt; + enableFishIntegration = + mkShellIntegrationOption lib.hm.shell.mkFishIntegrationOption; - enableZshIntegration = mkEnableOption "Kitty Z Shell integration" - // shellIntegrationDefaultOpt; + enableZshIntegration = + mkShellIntegrationOption lib.hm.shell.mkZshIntegrationOption; }; extraConfig = mkOption { diff --git a/modules/programs/mcfly.nix b/modules/programs/mcfly.nix index d0dddba21..49f5714a6 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 config.shell.enableBashIntegration; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Fish integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; }; config = mkIf cfg.enable (mkMerge [ diff --git a/modules/programs/mise.nix b/modules/programs/mise.nix index 404f1bf9c..bf2c7c6e7 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 config.shell.enableBashIntegration; - enableZshIntegration = mkEnableOption "Zsh Integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkEnableOption "Fish Integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; globalConfig = mkOption { type = tomlFormat.type; diff --git a/modules/programs/navi.nix b/modules/programs/navi.nix index aff50b5c7..188983052 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 config.shell.enableBashIntegration; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; }; config = mkIf cfg.enable { diff --git a/modules/programs/nix-index.nix b/modules/programs/nix-index.nix index cdf3151c6..32ebeba1d 100644 --- a/modules/programs/nix-index.nix +++ b/modules/programs/nix-index.nix @@ -13,17 +13,14 @@ in { description = "Package providing the {command}`nix-index` tool."; }; - enableBashIntegration = mkEnableOption "Bash integration" // { - default = true; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption config.shell.enableBashIntegration; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; }; config = lib.mkIf cfg.enable { diff --git a/modules/programs/nix-your-shell.nix b/modules/programs/nix-your-shell.nix index 20b5fd19e..5d9f03c54 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 config.shell.enableFishIntegration; - enableNushellIntegration = mkEnableOption "Nushell integration" // { - default = true; - }; + enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption + config.shell.enableNushellIntegration; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; }; config = mkIf cfg.enable { diff --git a/modules/programs/oh-my-posh.nix b/modules/programs/oh-my-posh.nix index 8c46a1c69..75af202f7 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 config.shell.enableBashIntegration; - enableZshIntegration = mkOption { - type = types.bool; - default = true; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkOption { - type = types.bool; - default = true; - description = '' - Whether to enable Fish integration. - ''; - }; + enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption + config.shell.enableNushellIntegration; - enableNushellIntegration = mkOption { - type = types.bool; - default = true; - description = '' - Whether to enable Nushell integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; }; config = mkIf cfg.enable { diff --git a/modules/programs/opam.nix b/modules/programs/opam.nix index 34338514a..d3a6cdad7 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 config.shell.enableBashIntegration; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Fish integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; }; config = mkIf cfg.enable { diff --git a/modules/programs/pay-respects.nix b/modules/programs/pay-respects.nix index ea47bee4c..357ba9098 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 config.shell.enableBashIntegration; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption + config.shell.enableNushellIntegration; - enableNushellIntegration = mkEnableOption "Nushell integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; }; config = mkIf cfg.enable { diff --git a/modules/programs/pazi.nix b/modules/programs/pazi.nix index 9e603df23..4c7f16a2f 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 config.shell.enableBashIntegration; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Fish integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; }; config = mkIf cfg.enable { diff --git a/modules/programs/pyenv.nix b/modules/programs/pyenv.nix index c2273c676..3748946d6 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 config.shell.enableBashIntegration; - enableZshIntegration = lib.mkOption { - type = lib.types.bool; - default = true; - description = '' - Whether to enable pyenv's Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = lib.mkOption { - type = lib.types.bool; - default = true; - description = '' - Whether to enable pyenv's Fish integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; rootDirectory = lib.mkOption { type = lib.types.path; diff --git a/modules/programs/rbenv.nix b/modules/programs/rbenv.nix index e740c5602..68818d698 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 config.shell.enableBashIntegration; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; }; config = mkIf cfg.enable { diff --git a/modules/programs/skim.nix b/modules/programs/skim.nix index 2bb17d1b9..888af45fa 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 config.shell.enableBashIntegration; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Fish integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; }; config = mkIf cfg.enable { diff --git a/modules/programs/starship.nix b/modules/programs/starship.nix index 654c43fca..695ba8b99 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 config.shell.enableBashIntegration; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableIonIntegration = + lib.hm.shell.mkIonIntegrationOption config.shell.enableIonIntegration; - enableIonIntegration = mkEnableOption "Ion integration" // { - default = true; - }; + enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption + config.shell.enableNushellIntegration; - enableNushellIntegration = mkEnableOption "Nushell integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; enableInteractive = mkOption { type = types.bool; diff --git a/modules/programs/thefuck.nix b/modules/programs/thefuck.nix index ab56ea016..453b42366 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 config.shell.enableBashIntegration; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption + config.shell.enableNushellIntegration; - enableNushellIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Nushell integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; }; config = let diff --git a/modules/programs/watson.nix b/modules/programs/watson.nix index c842c519a..ec60a868c 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 config.shell.enableBashIntegration; - enableZshIntegration = mkEnableOption "watson's zsh integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkEnableOption "watson's fish integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; settings = mkOption { type = iniFormat.type; diff --git a/modules/programs/wezterm.nix b/modules/programs/wezterm.nix index bd3be4686..d57c5ee64 100644 --- a/modules/programs/wezterm.nix +++ b/modules/programs/wezterm.nix @@ -83,13 +83,11 @@ in { ''; }; - enableBashIntegration = mkEnableOption "WezTerm's Bash integration" // { - default = true; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption config.shell.enableBashIntegration; - enableZshIntegration = mkEnableOption "WezTerm's Zsh integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; }; config = mkIf cfg.enable { diff --git a/modules/programs/yazi.nix b/modules/programs/yazi.nix index a17f2952e..71e67b352 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 config.shell.enableBashIntegration; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption + config.shell.enableNushellIntegration; - enableNushellIntegration = mkEnableOption "Nushell integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; keymap = mkOption { type = tomlFormat.type; diff --git a/modules/programs/z-lua.nix b/modules/programs/z-lua.nix index 74dee31dc..7913de025 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 config.shell.enableBashIntegration; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Fish integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; enableAliases = mkOption { default = false; diff --git a/modules/programs/zellij.nix b/modules/programs/zellij.nix index 0906a028d..6657f1a43 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 config.shell.enableBashIntegration; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = false; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = false; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; }; config = mkIf cfg.enable { diff --git a/modules/programs/zoxide.nix b/modules/programs/zoxide.nix index f5e258af9..67f1401f8 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 config.shell.enableBashIntegration; - enableZshIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Zsh integration. - ''; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Fish integration. - ''; - }; + enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption + config.shell.enableNushellIntegration; - enableNushellIntegration = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable Nushell integration. - ''; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; }; config = mkIf cfg.enable { diff --git a/modules/services/gpg-agent.nix b/modules/services/gpg-agent.nix index edb87a9d1..e5694ee8f 100644 --- a/modules/services/gpg-agent.nix +++ b/modules/services/gpg-agent.nix @@ -245,21 +245,17 @@ in { ''; }; - enableBashIntegration = mkEnableOption "Bash integration" // { - default = true; - }; + enableBashIntegration = + lib.hm.shell.mkBashIntegrationOption config.shell.enableBashIntegration; - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption config.shell.enableFishIntegration; - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; + enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption + config.shell.enableNushellIntegration; - enableNushellIntegration = mkEnableOption "Nushell integration" // { - default = true; - }; + enableZshIntegration = + lib.hm.shell.mkZshIntegrationOption config.shell.enableZshIntegration; }; };