anchor.diff:          type = types.bool;
         };
   
  +      useBabelfish = mkOption {
  +        type = types.bool;
  +        default = false;
  +        description = ''
  +          If enabled, the configured environment will be translated to native fish using <link xlink:href="https://github.com/bouk/babelfish">babelfish</link>.
  +          Otherwise, <link xlink:href="https://github.com/oh-my-fish/plugin-foreign-env">foreign-env</link> will be used.
  +        '';
  +      };
  +
         vendor.config.enable = mkOption {
           type = types.bool;
           default = true;
  
positive.code:     # Required for man completions
      documentation.man.generateCaches = lib.mkDefault true;
  
      environment.etc."fish/foreign-env/shellInit".text = cfge.shellInit;
      environment.etc."fish/foreign-env/loginShellInit".text = cfge.loginShellInit;
      environment.etc."fish/foreign-env/interactiveShellInit".text = cfge.interactiveShellInit;
  
      environment.etc."fish/nixos-env-preinit.fish".text = ''
        # This happens before $__fish_datadir/config.fish sets fish_function_path, so it is currently
        # unset. We set it and then completely erase it, leaving its configuration to $__fish_datadir/config.fish
        set fish_function_path ${pkgs.fishPlugins.foreign-env}/share/fish/vendor_functions.d $__fish_datadir/functions
  
        # source the NixOS environment config
        if [ -z "$__NIXOS_SET_ENVIRONMENT_DONE" ]
            fenv source ${config.system.build.setEnvironment}
        end
  
        # clear fish_function_path so that it will be correctly set when we return to $__fish_datadir/config.fish
        set -e fish_function_path
      '';
  
      environment.etc."fish/config.fish".text = ''
        # /etc/fish/config.fish: DO NOT EDIT -- this file has been generated automatically.
  
        # if we haven't sourced the general config, do it
        if not set -q __fish_nixos_general_config_sourced
          set --prepend fish_function_path ${pkgs.fishPlugins.foreign-env}/share/fish/vendor_functions.d
          fenv source /etc/fish/foreign-env/shellInit > /dev/null
          set -e fish_function_path[1]
  
          ${cfg.shellInit}
  
          # and leave a note so we don't source this config section again from
          # this very shell (children will source the general config anew)
          set -g __fish_nixos_general_config_sourced 1
        end
  
        # if we haven't sourced the login config, do it
        status --is-login; and not set -q __fish_nixos_login_config_sourced
        and begin
          set --prepend fish_function_path ${pkgs.fishPlugins.foreign-env}/share/fish/vendor_functions.d
          fenv source /etc/fish/foreign-env/loginShellInit > /dev/null
          set -e fish_function_path[1]
  
          ${cfg.loginShellInit}
  
          # and leave a note so we don't source this config section again from
          # this very shell (children will source the general config anew)
          set -g __fish_nixos_login_config_sourced 1
        end
  
        # if we haven't sourced the interactive config, do it
        status --is-interactive; and not set -q __fish_nixos_interactive_config_sourced
        and begin
          ${fishAliases}
  
          set --prepend fish_function_path ${pkgs.fishPlugins.foreign-env}/share/fish/vendor_functions.d
          fenv source /etc/fish/foreign-env/interactiveShellInit > /dev/null
          set -e fish_function_path[1]
  
          ${cfg.promptInit}
          ${cfg.interactiveShellInit}
  
          # and leave a note so we don't source this config section again from
          # this very shell (children will source the general config anew,
          # allowing configuration changes in, e.g, aliases, to propagate)
          set -g __fish_nixos_interactive_config_sourced 1
        end
      '';
  
      programs.fish.interactiveShellInit = ''
        # add completions generated by NixOS to $fish_complete_path
  
negative.code:       end
      '';
  
    };
  
  }
  