-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathflake.nix
More file actions
84 lines (73 loc) · 2.02 KB
/
Copy pathflake.nix
File metadata and controls
84 lines (73 loc) · 2.02 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
83
84
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
proto = {
url = "github:seabird-chat/proto";
flake = false;
};
};
outputs =
inputs@{
nixpkgs,
flake-parts,
proto,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = nixpkgs.lib.systems.flakeExposed;
perSystem =
{
pkgs,
system,
config,
lib,
...
}:
{
formatter = pkgs.treefmt.withConfig {
runtimeInputs = [
pkgs.nixfmt-rfc-style
pkgs.rustfmt
];
settings = {
on-unmatched = "info";
formatter.nixfmt = {
command = "nixfmt";
includes = [ "*.nix" ];
};
formatter.rustfmt = {
command = "rustfmt";
includes = [ "*.rs" ];
};
};
};
packages.default = pkgs.rustPlatform.buildRustPackage {
pname = "seabird-core";
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = [ pkgs.protobuf ];
SEABIRD_PROTO_PATH = "${proto}";
# Ensure we use sqlx in offline mode so it doesn't try to talk to
# a live database.
SQLX_OFFLINE = true;
};
devShells.default = pkgs.mkShell {
packages = [
pkgs.cargo
pkgs.rustc
pkgs.protobuf
pkgs.rust-analyzer
pkgs.sqlx-cli
pkgs.sqlite
];
shellHook = ''
export RUST_BACKTRACE=1
export DATABASE_URL="sqlite://$(git rev-parse --show-toplevel)/seabird.db";
export SEABIRD_PROTO_PATH="${proto}";
'';
};
};
};
}