Skip to content

Commit

Permalink
chore: Set ATUIN_ variables for development in devshell (#1653)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
matthiasbeyer committed Jan 30, 2024
1 parent 335f222 commit 8e520b1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
'';
});
})
// {
Expand Down

0 comments on commit 8e520b1

Please sign in to comment.