home-manager icon indicating copy to clipboard operation
home-manager copied to clipboard

bug: atuin not recording history in bash

Open pbek opened this issue 1 year ago • 2 comments

Are you following the right branch?

  • [X] My Nixpkgs and Home Manager versions are in sync

Is there an existing issue for this?

  • [X] I have searched the existing issues

Issue description

When I enter a command in a bash, no history is written. In fish, the history is written correctly to atuin. I've enabled atuin via home-manager using:

      atuin = {
        enable = true;
        enableFishIntegration = true;
        enableBashIntegration = true;
        # https://docs.atuin.sh/configuration/config/
        # Writes ~/.config/atuin/config.toml
        settings = {
          sync_address = "https://myserver";
          sync_frequency = "15m";
          key_path = "/home/${username}/.secrets/atuin-key";
          enter_accept = true;  # Enter runs command
          style = "compact";  # No extra box around UI
          inline_height = 32; # Maximum number of lines Atuin’s interface should take up
          prefers_reduced_motion = true;  # No automatic time updates
          workspaces = true;  # Filter in directories with git repositories
        };
      };

It works great with fish:

  • [x] recording atuin history
  • [x] showing atuin history with Ctrl + R or Up

With bash:

  • [ ] recording atuin history
  • [x] showing atuin history with Ctrl + R or Up

My ~./bashrc shows the correct:

if [[ :$SHELLOPTS: =~ :(vi|emacs): ]]; then
  source "/nix/store/xzfiimwq0li4d2xjgi0c3dfb5zg1yzxi-bash-preexec-0.5.0/share/bash/bash-preexec.sh"
  eval "$(/nix/store/csc2lny869byz6v2177qm498wlg22ssp-atuin-18.3.0/bin/atuin init bash )"
fi

Maybe it's an issue with bash-preexec? See https://docs.atuin.sh/guide/installation/#installing-the-shell-plugin. There is an issue noted where some history entries are not written.

Maintainer CC

@hawkw

System information

nixos-unstable

 - system: `"x86_64-linux"`
 - host os: `Linux 6.11.0, NixOS, 24.11 (Vicuna), 24.11.20241009.5633bcf`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.24.8`
 - channels(root): `"nixos"`
 - nixpkgs: `/run/current-system/nixpkgs`

pbek avatar Oct 12 '24 11:10 pbek

When I turn off enableBashIntegration and run this in a bash:

source "/nix/store/xzfiimwq0li4d2xjgi0c3dfb5zg1yzxi-bash-preexec-0.5.0/share/bash/bash-preexec.sh"
eval "$(/nix/store/csc2lny869byz6v2177qm498wlg22ssp-atuin-18.3.0/bin/atuin init bash )"

Then the same happens. I can show the atuin history with Ctrl + R or Up, but no history items are written.

pbek avatar Oct 18 '24 13:10 pbek

I haven't got things working with ble.sh either...

pbek avatar Oct 18 '24 14:10 pbek

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

  • If this is resolved, please consider closing it so that the maintainers know not to focus on this.
  • If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
If you are not the original author of the issue

  • If you are also experiencing this issue, please add details of your situation to help with the debugging process.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.

stale[bot] avatar Jan 18 '25 07:01 stale[bot]

same issue here: OS: NixOS 25.05 (Warbler) x86_64 Host: 20S1S8KN00 (ThinkPad T14 Gen 1) Kernel: Linux 6.12.10 Uptime: 14 hours, 38 mins Packages: 1397 (nix-system), 969 (nix-user) Shell: bash 5.2.37 Display (PHL 346E2C): 3440×1440 @ 75 Hz in 34" [External] DE: KDE Plasma WM: KWin (Wayland) WM Theme: Breeze

However, disabling shell integration and adding

bash = {
      enable = true;
      bashrcExtra = ''
        eval "$(${pkgs.atuin}/bin/atuin init --disable-up-arrow bash)"
      '';
    };

~Works or of course manually adding it to bashrc~ does not work for me — apparently I am blind and can't see the difference between atuin and fzf which coincidentally works perfectly fine.

jakob1379 avatar Jan 24 '25 08:01 jakob1379

eval "$(${pkgs.atuin}/bin/atuin init --disable-up-arrow bash)"

This unfortunately still didn't put anything in my Atuin history in bash...

pbek avatar Jan 24 '25 13:01 pbek

eval "$(${pkgs.atuin}/bin/atuin init --disable-up-arrow bash)"

This unfortunately still didn't put anything in my Atuin history in bash...

Can you give the home manager config where you put this? Because it won't work as is in bashrc

jakob1379 avatar Jan 24 '25 16:01 jakob1379

~~I didn't put it in the home manager config. 🤔~~

Edit: It is in the home manager config!

https://github.com/pbek/nixcfg/blob/4e68afeb1e59461e38bd83ba3489fa701e76e44d/modules/mixins/common.nix#L243-L245

pbek avatar Jan 24 '25 21:01 pbek

same issue here... suspecting conflicting default settings in home-manager bash that adds the following to my .bashrc

HISTFILESIZE=100000
HISTSIZE=10000

shopt -s histappend
shopt -s checkwinsize
shopt -s extglob
shopt -s globstar
shopt -s checkjobs

barnacker avatar Jan 29 '25 00:01 barnacker

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

  • If this is resolved, please consider closing it so that the maintainers know not to focus on this.
  • If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
If you are not the original author of the issue

  • If you are also experiencing this issue, please add details of your situation to help with the debugging process.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.

stale[bot] avatar May 13 '25 22:05 stale[bot]

I can confirm this bug is still present with bash version 5.2.37 and atuin 18.6.1.

pbek avatar Jun 23 '25 09:06 pbek

This upstream report looks related: https://github.com/atuinsh/atuin/issues/1798

bct avatar Jun 24 '25 21:06 bct

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

  • If this is resolved, please consider closing it so that the maintainers know not to focus on this.
  • If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
If you are not the original author of the issue

  • If you are also experiencing this issue, please add details of your situation to help with the debugging process.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.

stale[bot] avatar Oct 07 '25 06:10 stale[bot]

In case the problem seems to be a conflict with programs.direnv. If atuin is loaded after direnv, it works. If atuin is loaded before direnv but using ble.sh instead of bash-preexec, it works.

But by default it is loaded before direnv, with bash-preexec, and it will only record the first command executed in a shell.

bct avatar Nov 17 '25 14:11 bct

In my case at least I believe this is the same issue as https://github.com/direnv/direnv/issues/327 / https://github.com/rcaloras/bash-preexec/pull/143

bct avatar Nov 17 '25 15:11 bct