Skip to content

[Feature Request] programs.fish.autoSwitchFromShell / programs.nushell.autoSwitchFromShell #9006

@Malix-Labs

Description

@Malix-Labs

Module Name

programs.fish, programs.nushell, ... (non-POSIX compatible shells)

Requested Feature

To non-POSIX compatible shells (programs.fish, programs.nushell, ...), feature a autoSwitchFromShell option to abstract the mandatory programs.bash.initExtra / programs.zsh.initExtra when not using a POSIX compatible shell by default

  • Input
    • Type: lib.types.listOf (lib.types.enum [ "bash" "zsh" ])
    • Default: [ "bash" ]

An alternative would be to make two autoSwitchFromBash / autoSwitchFromZsh booleans

There is also the programs.ion shell available in home manager, but I am not familiar enough with it

Current Limitations

Currently, not using a POSIX compatible shell by default requires setting programs.bash.initExtra

For instance, using Nushell :

  programs = {
    nushell.enable = true;
    bash = {
      enable = true;
      initExtra = ''
        if [[ $- == *i* ]] && \
          [ -z "$BASH_EXECUTION_STRING" ] && \
          [ "$TERM" != "dumb" ] && \
          [[ ! "$(< /proc/$PPID/comm)" =~ ^nu(shell)?$ ]];
        then
          if shopt -q login_shell; then
            exec ${lib.getExe pkgs.nushell} --login
          else
            exec ${lib.getExe pkgs.nushell}
          fi
        fi
      '';
    };
  };

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions