aboutsummaryrefslogtreecommitdiffstats
path: root/flake.nix
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2024-01-30 15:04:15 +0100
committerGitHub <noreply@github.com>2024-01-30 14:04:15 +0000
commit8e520b1d722b03899e034f54942224537e0d2e96 (patch)
tree4e134e6a51e5865fbee6496dce56897186ee3731 /flake.nix
parentfix: never overwrite the key (#1657) (diff)
downloadatuin-8e520b1d722b03899e034f54942224537e0d2e96.zip
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>
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix14
1 files changed, 14 insertions, 0 deletions
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
+ '';
});
})
// {