aboutsummaryrefslogtreecommitdiffstats
path: root/flake.nix
blob: 66c34eb1254151c5498ddaac4615cd363900da59 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
  };

  outputs = {
    self,
    nixpkgs,
    ...
  }: let
    system = "x86_64-linux";
    pkgs = nixpkgs.outputs.legacyPackages.${system};
  in {
    packages."${system}" = {
      atuin = pkgs.callPackage ./atuin.nix {};
      default = self.outputs.packages.${system}.atuin;
    };

    devShells."${system}".default = self.packages.${system}.default.overrideAttrs (super: {
      nativeBuildInputs =
        super.nativeBuildInputs
        ++ [
          # rust stuff
          pkgs.cargo
          pkgs.clippy
          pkgs.rustc
          pkgs.rustfmt
          pkgs.mold

          pkgs.cargo-edit
          pkgs.cargo-expand
          pkgs.cargo-flamegraph
        ];
      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
      '';
    });
  };
}