-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathflake.nix
More file actions
77 lines (71 loc) · 2.79 KB
/
flake.nix
File metadata and controls
77 lines (71 loc) · 2.79 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
{
description = "Cross-platform Bun and Tauri development environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
# Use specific rust version required by Tauri
rustToolchain = pkgs.rust-bin.stable."1.88.0".default.override {
extensions = [ "rust-src" ];
};
in
{
devShells.default = pkgs.mkShell {
packages = [
pkgs.bun
pkgs.just
pkgs.jq
rustToolchain
# Basic build dependencies
pkgs.pkg-config
pkgs.openssl
# GTK dependencies for Tauri
pkgs.atk
pkgs.gtk3
pkgs.glib
pkgs.pango
pkgs.cairo
pkgs.gdk-pixbuf
pkgs.libsoup_3
pkgs.webkitgtk_4_1
] ++ (if pkgs.stdenv.isLinux then [
# Mesa with software rendering support for environments without a GPU
# (e.g., VMs, CI, containers). Provides libEGL_mesa.so and swrast DRI
# drivers needed by WebKitGTK to initialize EGL.
pkgs.mesa
# glib-networking provides the GIO TLS backend (libgiognutls.so) that
# WebKitGTK needs for HTTPS requests. Without it, all fetch() calls to
# HTTPS URLs fail with "Load failed" (e.g., attestation document fetch).
pkgs.glib-networking
] else []) ++ (if pkgs.stdenv.isDarwin then [
# macOS-specific dependencies
pkgs.darwin.apple_sdk.frameworks.WebKit
pkgs.darwin.apple_sdk.frameworks.AppKit
] else []);
# Set environment variables
shellHook = ''
echo "Using Rust version: $(rustc --version)"
echo "Tauri development environment ready"
''
# On Linux, configure Mesa EGL for software rendering so WebKitGTK works
# in environments without a GPU (VMs, containers, headless servers).
+ pkgs.lib.optionalString pkgs.stdenv.isLinux ''
export __EGL_VENDOR_LIBRARY_FILENAMES=${pkgs.mesa}/share/glvnd/egl_vendor.d/50_mesa.json
export LIBGL_DRIVERS_PATH=${pkgs.mesa}/lib/dri
export LIBGL_ALWAYS_SOFTWARE=1
export WEBKIT_DISABLE_COMPOSITING_MODE=1
export WEBKIT_DISABLE_DMABUF_RENDERER=1
export GIO_MODULE_DIR=${pkgs.glib-networking}/lib/gio/modules
'';
};
}
);
}