From 8e520b1d722b03899e034f54942224537e0d2e96 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 30 Jan 2024 15:04:15 +0100 Subject: 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 --- flake.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index ee5dcdd3..67833754 100644 --- a/flake.nix +++ b/flake.nix @@ -30,6 +30,20 @@ rustfmt ]; 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 + ''; }); }) // { -- cgit v1.3.1