[Solved] How to set /etc/nixos/configuration.nix for bash history

What way is nixOS like for conf the bash_rc. I’m surprised that the bash_rc after installation is empty. Should the settings for bashhistory and for example the PS1 set in /etc/nixos/configuration.nix ? Please post an example or Url for how to?

Thanks!

ltx

Setting the bash configuration can be done either with configuration.nix and programs.bash options.

Or with Home-Manager. But it is out of my reach.

@Sparsetacus has excellent advice. If you are not using home manager, see the options link provided.

If you are using home-manager, then see the programs.bash options. Here is my home-manager example:

  programs.bash = {
    enable = true;
    enableCompletion = true;
    enableVteIntegration = true;
    historyControl = ["erasedups" "ignoredups" "ignorespace"];
    bashrcExtra = ''
      export PINENTRY_PROGRAM="$(command -v pinentryutf8)"
      . $(command -v sshagent)
    '';
    shellAliases = {
      ls1 = "eza -1 --icons=never";
    };
  };
1 Like