chore: Set ATUIN_ variables for development in devshell (#1653)

I accidentially broke my atuin database by executing `atuin` from the
PR I was working on without setting these variables and had to manually
roll back my local database.

That shouldn't happen, so we set the database and record store path in
the devshell to something that does not overwrite our normal databases.
We also warn if these files already exist, because when entering the
devshell, a user might want to start from a clean slate here.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2024-01-30 15:04:15 +01:00 committed by GitHub
parent 335f2220c3
commit 8e520b1d72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,6 +30,20 @@
rustfmt rustfmt
]; ];
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}"; RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
shellHook = ''
echo >&2 "Setting development database path"
export ATUIN_DB_PATH="/tmp/atuin_dev.db"
export ATUIN_RECORD_STORE_PATH="/tmp/atuin_records.db"
if [ -e "''${ATUIN_DB_PATH}" ]; then
echo >&2 "''${ATUIN_DB_PATH} already exists, you might want to double-check that"
fi
if [ -e "''${ATUIN_RECORD_STORE_PATH}" ]; then
echo >&2 "''${ATUIN_RECORD_STORE_PATH} already exists, you might want to double-check that"
fi
'';
}); });
}) })
// { // {