This repository was archived by the owner on Feb 19, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
118 lines (99 loc) · 3.05 KB
/
flake.nix
File metadata and controls
118 lines (99 loc) · 3.05 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
{
description = "BMS Resource Toolbox - Nix development environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
flake-utils,
rust-overlay,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
overlays = [
# Rust
(final: prev: {
rust-bin = rust-overlay.lib.mkRustBin { distRoot = "https://rsproxy.cn/dist"; } prev;
})
];
pkgs = import nixpkgs {
inherit system overlays;
};
# System dependencies for unrar and other libraries
buildInputs = with pkgs; [
# Rust toolchain from rust-overlay
pkgs.rust-bin.stable.latest.complete
# C/C++ build tools for native dependencies
clang
llvmPackages.libclang
pkg-config
# Archive utilities
libarchive
p7zip
# System libraries for unrar
gcc
gcc-unwrapped
# Essential GUI libraries for iced applications
xorg.libX11
xorg.libXcursor
xorg.libXrandr
xorg.libXi
# Wayland libraries
wayland
wayland-protocols
libxkbcommon
xkeyboard_config
# Additional libraries that might be needed
openssl
sqlite
libiconv
# GUI libraries
libGL
libglvnd
mesa
];
# Native build inputs for linking
nativeBuildInputs = with pkgs; [
cmake
makeWrapper
# X Virtual Framebuffer for headless GUI testing
xvfb-run
];
# Environment variables
shellHook = ''
echo "🚀 BMS Resource Toolbox Development Environment"
echo "Rust version: $(rustc --version)"
echo "Cargo version: $(cargo --version)"
export RUST_BACKTRACE=1
export CARGO_BUILD_JOBS=$NIX_BUILD_CORES
export LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib"
export LD_LIBRARY_PATH="${pkgs.llvmPackages.libclang.lib}/lib:$LD_LIBRARY_PATH"
# Essential GUI library paths including Wayland
export LD_LIBRARY_PATH="${pkgs.wayland}/lib:${pkgs.libxkbcommon}/lib:${pkgs.libGL}/lib:$LD_LIBRARY_PATH"
export XKB_CONFIG_ROOT="${pkgs.xkeyboard_config}/share/X11/xkb"
echo "Ready to run GUI application."
echo "Run: cargo run"
'';
in
{
# Development shell
devShells.default = pkgs.mkShell {
inherit buildInputs nativeBuildInputs shellHook;
# Environment variables for Rust development
env = {
RUST_SRC_PATH = "${pkgs.rust-bin.stable.latest.complete}/lib/rustlib/src/rust/library";
};
};
# Formatter for nix files
formatter = pkgs.nixfmt-tree;
}
);
}