mirror of
https://github.com/atuinsh/atuin.git
synced 2024-12-29 10:29:55 +01:00
8e520b1d72
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>
55 lines
1.6 KiB
Nix
55 lines
1.6 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
flake-compat = {
|
|
url = "github:edolstra/flake-compat";
|
|
flake = false;
|
|
};
|
|
};
|
|
outputs = {
|
|
self,
|
|
nixpkgs,
|
|
flake-utils,
|
|
...
|
|
}:
|
|
flake-utils.lib.eachDefaultSystem (system: let
|
|
pkgs = nixpkgs.outputs.legacyPackages.${system};
|
|
in {
|
|
packages.atuin = pkgs.callPackage ./atuin.nix {
|
|
inherit (pkgs.darwin.apple_sdk.frameworks) Security SystemConfiguration AppKit;
|
|
};
|
|
packages.default = self.outputs.packages.${system}.atuin;
|
|
|
|
devShells.default = self.packages.${system}.default.overrideAttrs (super: {
|
|
nativeBuildInputs = with pkgs;
|
|
super.nativeBuildInputs
|
|
++ [
|
|
cargo-edit
|
|
clippy
|
|
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
|
|
'';
|
|
});
|
|
})
|
|
// {
|
|
overlays.default = final: prev: {
|
|
inherit (self.packages.${final.system}) atuin;
|
|
};
|
|
};
|
|
}
|