-
-
Notifications
You must be signed in to change notification settings - Fork 971
Expand file tree
/
Copy pathflake.nix
More file actions
82 lines (73 loc) · 2.38 KB
/
Copy pathflake.nix
File metadata and controls
82 lines (73 loc) · 2.38 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs@{ flake-parts, fenix, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
perSystem =
{ pkgs, system, ... }:
let
toolchain = fenix.packages.${system}.fromToolchainFile {
file = ./rust-toolchain.toml;
sha256 = "sha256-P30Tm3O7vQAE725YtDCDHGjNrSsfZO4us11UwJGZSJo=";
};
atuin = pkgs.callPackage ./atuin.nix {
rustPlatform = pkgs.makeRustPlatform {
cargo = toolchain;
rustc = toolchain;
};
};
in
{
packages = {
inherit atuin;
default = atuin;
};
formatter = pkgs.nixfmt-tree;
devShells.default = pkgs.mkShell {
inputsFrom = [ atuin ];
nativeBuildInputs =
(with pkgs; [
cargo-edit
rust-analyzer
])
++ [ toolchain ];
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
shellHook = ''
# See atuin.nix's preBuild for explanation.
export LD_LIBRARY_PATH="${
pkgs.lib.makeLibraryPath [ pkgs.openssl ]
}''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
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
'';
};
};
flake.overlays.default = final: _: {
inherit (inputs.self.packages.${final.stdenv.hostPlatform.system}) atuin;
};
};
}