-
-
Notifications
You must be signed in to change notification settings - Fork 98
Expand file tree
/
Copy pathflake.nix
More file actions
149 lines (129 loc) · 4.67 KB
/
flake.nix
File metadata and controls
149 lines (129 loc) · 4.67 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
{
description = "Helmor - Local-first desktop app development environment";
inputs = {
# Use 24.11 stable - last known release with working Darwin SDK
# Note: 25.11 exists but has breaking Darwin SDK changes as of 2026-04
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
# Keep nixpkgs-unstable available for bleeding-edge packages if needed
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixpkgs-unstable, flake-utils, rust-overlay }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
# Make unstable packages available if needed
pkgs-unstable = import nixpkgs-unstable {
inherit system;
};
# Use stable Rust toolchain
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" "rust-analyzer" "clippy" ];
};
# Common build inputs for all platforms
# Note: To use a package from unstable, use pkgs-unstable.packageName
# Example: pkgs-unstable.bun (if you need bleeding edge)
commonBuildInputs = with pkgs; [
# Bun runtime (JavaScript/TypeScript)
bun
# Rust toolchain
rustToolchain
cargo-watch
# Build essentials
pkg-config
openssl
# Git (for version control operations)
git
# Node.js (some tools may need it)
nodejs_20
];
# Platform-specific dependencies
darwinInputs = with pkgs; [
# macOS-specific frameworks and tools
libiconv
] ++ (with pkgs.darwin.apple_sdk.frameworks; [
Security
CoreServices
CoreFoundation
Foundation
AppKit
WebKit
Cocoa
]);
linuxInputs = with pkgs; [
# Linux-specific Tauri dependencies
webkitgtk_4_1
gtk3
cairo
gdk-pixbuf
glib
dbus
openssl_3
librsvg
libsoup_3
# Additional Linux build tools
atk
pango
];
buildInputs = commonBuildInputs
++ pkgs.lib.optionals pkgs.stdenv.isDarwin darwinInputs
++ pkgs.lib.optionals pkgs.stdenv.isLinux linuxInputs;
# Environment variables
shellHook = ''
# Rust environment
export RUST_BACKTRACE=1
export RUST_LOG=info
# Tauri environment
${if pkgs.stdenv.isLinux then ''
export PKG_CONFIG_PATH="${pkgs.openssl_3.dev}/lib/pkgconfig:${pkgs.webkitgtk_4_1}/lib/pkgconfig:${pkgs.gtk3}/lib/pkgconfig:$PKG_CONFIG_PATH"
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath linuxInputs}:$LD_LIBRARY_PATH"
'' else ""}
# Helmor data directory (optional override)
# export HELMOR_DATA_DIR="$HOME/helmor-dev"
# Helmor logging (optional override)
# export HELMOR_LOG=debug
echo "🚀 Helmor development environment loaded!"
echo ""
echo "📦 Available tools:"
echo " - bun $(bun --version)"
echo " - rustc $(rustc --version)"
echo " - cargo $(cargo --version)"
echo " - node $(node --version)"
echo ""
echo "🔨 Common commands:"
echo " bun install # Install dependencies"
echo " bun run dev # Start dev server (Tauri + Vite)"
echo " bun run dev:analyze # Dev with perf HUD"
echo " bun run build # Build frontend"
echo " bun run typecheck # Type check"
echo " bun run lint # Lint (biome + clippy)"
echo " bun run lint:fix # Auto-fix lint issues"
echo " bun run test # Run all tests"
echo ""
echo "🧪 Test commands:"
echo " bun run test:frontend # Vitest tests"
echo " bun run test:sidecar # Sidecar tests"
echo " bun run test:rust # Rust tests"
echo ""
'';
in
{
devShells.default = pkgs.mkShell {
inherit buildInputs shellHook;
# Additional native build inputs for linking
nativeBuildInputs = with pkgs; [
pkg-config
];
};
# Alias for convenience
devShell = self.devShells.${system}.default;
}
);
}