forked from tursodatabase/turso
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
88 lines (81 loc) · 2.62 KB
/
flake.nix
File metadata and controls
88 lines (81 loc) · 2.62 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
85
86
87
88
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
crane.url = "github:ipetkov/crane";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, flake-utils, rust-overlay, crane, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
toolchain = (pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml).override {
extensions = [ "rust-analyzer" "rust-src" ];
targets = [ "wasm32-unknown-unknown" ];
};
lib = pkgs.lib;
# Custom SQLite package with debug enabled
sqlite-debug = pkgs.sqlite.overrideAttrs (oldAttrs: rec {
name = "sqlite-debug-${oldAttrs.version}";
configureFlags = oldAttrs.configureFlags ++ [ "--enable-debug" ];
dontStrip = true;
separateDebugInfo = true;
});
cargoArtifacts = craneLib.buildDepsOnly {
src = ./.;
pname = "turso";
nativeBuildInputs = with pkgs; [ python3 ];
};
commonArgs = {
inherit cargoArtifacts;
pname = "turso";
src = ./.;
nativeBuildInputs = with pkgs; [ python3 ];
strictDeps = true;
};
craneLib = ((crane.mkLib pkgs).overrideToolchain toolchain);
in
rec {
formatter = pkgs.nixpkgs-fmt;
checks = {
doc = craneLib.cargoDoc commonArgs;
fmt = craneLib.cargoFmt commonArgs;
clippy = craneLib.cargoClippy (commonArgs // {
# TODO: maybe add `-- --deny warnings`
cargoClippyExtraArgs = "--all-targets";
});
};
packages.turso_cli = craneLib.buildPackage (commonArgs // {
cargoExtraArgs = "--package turso_cli";
});
packages.default = packages.turso_cli;
devShells.default = with pkgs; mkShell {
nativeBuildInputs = [
clang
sqlite-debug # Use debug-enabled SQLite
gnumake
tcl
python3
nodejs
toolchain
uv
] ++ lib.optionals pkgs.stdenv.isDarwin [
apple-sdk
];
};
devShells.fuzz = with pkgs; mkShell {
nativeBuildInputs = [
(pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal))
] ++ lib.optionals pkgs.stdenv.isDarwin [
apple-sdk
];
};
}
);
}