-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
96 lines (84 loc) · 3.04 KB
/
Copy pathflake.nix
File metadata and controls
96 lines (84 loc) · 3.04 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
89
90
91
92
93
94
95
96
{
description = "Timbre — dev environment for the Tauri shell, React UI, and Python sidecar";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfreePredicate = pkg:
builtins.elem (nixpkgs.lib.getName pkg) [
"timbre"
];
};
inherit (pkgs) lib stdenv;
# Core toolchains — match what's actually used by the project:
# * Rust shell -> rustc / cargo / rustfmt / clippy
# * React UI -> nodejs + pnpm (Vite, Tauri CLI, etc.)
# * Python sidecar -> python 3.12 (project pins >=3.10,<3.13)
# The embedded-Python backend pack the app installs at runtime is
# downloaded into the user's app-data dir via python-build-standalone,
# so we don't bundle it here.
common = with pkgs; [
rustc
cargo
rustfmt
clippy
rust-analyzer
nodejs_24
pnpm
python312
uv
pkg-config
git
curl
];
# Tauri's WebView backends differ per OS. macOS uses the system
# WKWebView (no extra deps); Linux needs WebKitGTK + friends.
darwinDeps = with pkgs; lib.optionals stdenv.isDarwin [
libiconv
];
linuxDeps = with pkgs; lib.optionals stdenv.isLinux [
openssl
glib
gtk3
libsoup_3
webkitgtk_4_1
librsvg
gdk-pixbuf
cairo
pango
atk
];
in {
devShells.default = pkgs.mkShell {
packages = common ++ darwinDeps ++ linuxDeps;
shellHook = ''
export RUST_BACKTRACE=1
# Keep cargo / pnpm artifacts inside the project so a `nix store gc`
# never trashes them.
export CARGO_HOME="$PWD/.cargo"
export PNPM_HOME="$PWD/.pnpm-store"
export PATH="$CARGO_HOME/bin:$PNPM_HOME:$PATH"
echo "Timbre dev shell:"
echo " rust $(rustc --version | awk '{print $2}')"
echo " node $(node --version)"
echo " pnpm $(pnpm --version)"
echo " python $(python3 --version | awk '{print $2}')"
'';
};
# Nix-buildable Timbre binary. Linux x86_64 only: the FirstRun runtime
# download manifest currently ships Linux Python/uv assets for x86_64.
# Tauri's macOS bundling relies on Apple tooling that nixpkgs doesn't
# currently package well, and Windows Nix builds aren't a target.
packages = lib.optionalAttrs (system == "x86_64-linux") rec {
timbre = pkgs.callPackage ./nix/timbre.nix {};
default = timbre;
};
# `nix fmt` runs nixpkgs-fmt over the flake itself.
formatter = pkgs.nixpkgs-fmt;
});
}