Neofetch startup with fish shell

I want to execute neofetch every time when I open my terminal every time. But still, I can’t figure it out how to do it in nixos with home-manager?

It depends; When you open your terminal, the thing showing the characters inside of it is actually not “the terminal”, but a small application inside it called a “shell”.

It’s responsible for parsing your command lines, as well as executing programs and doing just about everything your “terminal” does, except for telling your GPU how to display the results.

As such, you need to configure your shell to run neofetch every time you start it. Furthermore, you probably want to configure your shell to only do so when you’re running an interactive session, because you probably don’t want to run neofetch every time a program starts (your shell is run in far more contexts than just in your terminal).

That’s pretty easy, but it depends on the shell you use. There are a handful of choices, the typical “default” is bash. home-manager has options to configure your bash configuration files: Appendix A. Configuration Options

To launch neofetch every time bash starts in an interactive session, you’d do something like this:

programs.bash = {
  enable = true;
  initExtra = ''

You might want to double check that this indeed only executes in interactive sessions. You can do some further filtering based on environment variables that signify which terminal is executing bash.

You’ll probably also have to move the rest of your ~/.bashrc into that configuration. If you’d like some inspiration on how to do this neatly, you might like my zsh config (different shell, but same concept).

1 Like