Skip to content
This repository was archived by the owner on Feb 19, 2026. It is now read-only.

Commit ddd4d31

Browse files
committed
add: flake.nix
1 parent c20ee9a commit ddd4d31

File tree

2 files changed

+175
-0
lines changed

2 files changed

+175
-0
lines changed

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
{
2+
description = "BMS Resource Toolbox - Nix development environment";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs = { self, nixpkgs, flake-utils }:
10+
flake-utils.lib.eachDefaultSystem (system:
11+
let
12+
pkgs = nixpkgs.legacyPackages.${system};
13+
14+
# System dependencies for unrar and other libraries
15+
buildInputs = with pkgs; [
16+
# Core build tools
17+
rustc
18+
cargo
19+
rust-analyzer
20+
rustfmt
21+
clippy
22+
23+
# C/C++ build tools for native dependencies
24+
clang
25+
llvmPackages.libclang
26+
pkg-config
27+
28+
# Archive utilities
29+
libarchive
30+
p7zip
31+
32+
# System libraries for unrar
33+
gcc
34+
gcc-unwrapped
35+
36+
# GUI/X11 libraries for iced applications
37+
xorg.libX11
38+
xorg.libXcursor
39+
xorg.libXrandr
40+
xorg.libXi
41+
xorg.libXext
42+
xorg.libXfixes
43+
xorg.libXrender
44+
xorg.libXinerama
45+
xorg.libXft
46+
xorg.libXcomposite
47+
xorg.libXdamage
48+
xorg.libXtst
49+
xorg.libXScrnSaver
50+
51+
# Wayland libraries
52+
wayland
53+
wayland-protocols
54+
libxkbcommon
55+
56+
# Additional libraries that might be needed
57+
openssl
58+
sqlite
59+
libiconv
60+
61+
# Font libraries
62+
fontconfig
63+
freetype
64+
libGL
65+
libglvnd
66+
mesa
67+
libdrm
68+
];
69+
70+
# Native build inputs for linking
71+
nativeBuildInputs = with pkgs; [
72+
cmake
73+
makeWrapper
74+
75+
# X Virtual Framebuffer for headless GUI testing
76+
xvfb-run
77+
];
78+
79+
# Environment variables
80+
shellHook = ''
81+
echo "🚀 BMS Resource Toolbox Development Environment"
82+
echo "Rust version: $(rustc --version)"
83+
echo "Cargo version: $(cargo --version)"
84+
export RUST_BACKTRACE=1
85+
export CARGO_BUILD_JOBS=$NIX_BUILD_CORES
86+
export LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib"
87+
export LD_LIBRARY_PATH="${pkgs.llvmPackages.libclang.lib}/lib:$LD_LIBRARY_PATH"
88+
89+
# GUI application library paths for Hyprland/Wayland
90+
export LD_LIBRARY_PATH="${pkgs.libGL}/lib:${pkgs.fontconfig}/lib:${pkgs.freetype}/lib:$LD_LIBRARY_PATH"
91+
92+
# Don't override existing display environment variables in Hyprland
93+
# Let the native Hyprland/Wayland environment take precedence
94+
95+
echo "GUI libraries loaded. Ready for Hyprland/Wayland environment."
96+
echo "Run: cargo run --bin bms-resource-toolbox-gui"
97+
'';
98+
in
99+
{
100+
# Development shell
101+
devShells.default = pkgs.mkShell {
102+
inherit buildInputs nativeBuildInputs shellHook;
103+
104+
# Environment variables for Rust development
105+
env = {
106+
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
107+
};
108+
};
109+
110+
# Formatter for nix files
111+
formatter = pkgs.nixpkgs-fmt;
112+
}
113+
);
114+
}

0 commit comments

Comments
 (0)