From def1e23be848848400d1d097d4f044e3c401f9dd Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Sun, 14 Apr 2024 23:02:32 +0200 Subject: treewide: remove lib.mdDoc --- modules/programs/bash/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'modules/programs/bash/default.nix') diff --git a/modules/programs/bash/default.nix b/modules/programs/bash/default.nix index 61f82e0..2e27ff9 100644 --- a/modules/programs/bash/default.nix +++ b/modules/programs/bash/default.nix @@ -12,19 +12,19 @@ in programs.bash.enable = mkOption { type = types.bool; default = true; - description = lib.mdDoc "Whether to configure bash as an interactive shell."; + description = "Whether to configure bash as an interactive shell."; }; programs.bash.interactiveShellInit = mkOption { default = ""; - description = lib.mdDoc "Shell script code called during interactive bash shell initialisation."; + description = "Shell script code called during interactive bash shell initialisation."; type = types.lines; }; programs.bash.enableCompletion = mkOption { type = types.bool; default = false; - description = lib.mdDoc '' + description = '' Enable bash completion for all interactive bash shells. NOTE. This doesn't work with bash 3.2, which is the default on macOS. -- cgit v1.2.3 From 953d02ba5958df017d9682f727d10a75cb8a0391 Mon Sep 17 00:00:00 2001 From: Antoine Cotten Date: Thu, 12 Sep 2024 17:37:56 +0000 Subject: {bash,zsh}: remove nix-shell early return in /etc/{bashrc,zshenv} The condition does not match the comment, and therefore not the original intention. It currently returns early in *any* type of Nix shell, not just pure ones, including 'nix develop'. Besides being unnecessary, this check prevents Nix shells from functioning properly. For instance, it causes the initialization of the Zsh fpath to be skipped, which is critical. The fact that the user is unable to opt out of this behaviour makes this an ever bigger problem since /etc/zshenv is being loaded unconditionally by Zsh. For reference, NixOS does not perform such check, and apparently never did. --- modules/programs/bash/default.nix | 3 --- 1 file changed, 3 deletions(-) (limited to 'modules/programs/bash/default.nix') diff --git a/modules/programs/bash/default.nix b/modules/programs/bash/default.nix index 2e27ff9..3abb3e8 100644 --- a/modules/programs/bash/default.nix +++ b/modules/programs/bash/default.nix @@ -55,9 +55,6 @@ in if [ -n "$__ETC_BASHRC_SOURCED" -o -n "$NOSYSBASHRC" ]; then return; fi __ETC_BASHRC_SOURCED=1 - # Don't execute this file when running in a pure nix-shell. - if [ "$IN_NIX_SHELL" = "pure" ]; then return; fi - if [ -z "$__NIX_DARWIN_SET_ENVIRONMENT_DONE" ]; then . ${config.system.build.setEnvironment} fi -- cgit v1.2.3 From c9fd4820d5e33422d2a9311898e098ba492dbd34 Mon Sep 17 00:00:00 2001 From: isabel Date: Mon, 30 Sep 2024 16:30:50 +0100 Subject: programs/bash: move to completion.* a port of https://github.com/NixOS/nixpkgs/pull/291552 for darwin --- modules/programs/bash/default.nix | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'modules/programs/bash/default.nix') diff --git a/modules/programs/bash/default.nix b/modules/programs/bash/default.nix index 3abb3e8..2518c9c 100644 --- a/modules/programs/bash/default.nix +++ b/modules/programs/bash/default.nix @@ -7,6 +7,10 @@ let in { + imports = [ + (mkRenamedOptionModule [ "programs" "bash" "enableCompletion" ] [ "programs" "bash" "completion" "enable" ]) + ]; + options = { programs.bash.enable = mkOption { @@ -21,14 +25,18 @@ in type = types.lines; }; - programs.bash.enableCompletion = mkOption { - type = types.bool; - default = false; - description = '' - Enable bash completion for all interactive bash shells. + programs.bash.completion = { + enable = mkOption { + type = types.bool; + default = false; + description = '' + Enable bash completion for all interactive bash shells. + + NOTE: This doesn't work with bash 3.2, which is installed by default on macOS by Apple. + ''; + }; - NOTE. This doesn't work with bash 3.2, which is the default on macOS. - ''; + package = mkPackageOption pkgs "bash-completion" { }; }; }; @@ -38,9 +46,9 @@ in environment.systemPackages = [ # Include bash package pkgs.bashInteractive - ] ++ optional cfg.enableCompletion pkgs.bash-completion; + ] ++ optional cfg.completion.enable cfg.completion.package; - environment.pathsToLink = + environment.pathsToLink = optionals cfg.completion.enable [ "/etc/bash_completion.d" "/share/bash-completion/completions" ]; @@ -70,9 +78,9 @@ in ${config.environment.interactiveShellInit} ${cfg.interactiveShellInit} - ${optionalString cfg.enableCompletion '' + ${optionalString cfg.completion.enable '' if [ "$TERM" != "dumb" ]; then - source "${pkgs.bash-completion}/etc/profile.d/bash_completion.sh" + source "${cfg.completion.package}/etc/profile.d/bash_completion.sh" nullglobStatus=$(shopt -p nullglob) shopt -s nullglob -- cgit v1.2.3