-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathflake.nix
More file actions
86 lines (73 loc) · 2.53 KB
/
flake.nix
File metadata and controls
86 lines (73 loc) · 2.53 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
{
description = "A very basic flake for Rust Slint GUI framework";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, rust-overlay }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlays.default ];
};
# Create a custom stdenv that uses gcc instead of clang
gccStdenv = pkgs.overrideCC pkgs.stdenv pkgs.gcc;
shellBuildInputs = with pkgs; [
wayland
openssl
libGL.dev
xorg.libxcb
libxkbcommon
stdenv.cc.cc.lib
qt6.full
pkg-config
alsa-lib.dev
pipewire.dev
x264.dev
ffmpeg.dev
];
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
# targets = [ "aarch64-linux-android" "wasm32-unknown-unknown" ];
};
in {
devShells.${system}.default =
pkgs.mkShell.override { stdenv = gccStdenv; } {
nativeBuildInputs = with pkgs; [
gcc
llvm
clang
python3
gnumake
rustToolchain
rust-analyzer
];
buildInputs = shellBuildInputs;
env = {
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath shellBuildInputs;
# Force GCC for C/C++ compilation
CC = "${pkgs.gcc}/bin/gcc";
CXX = "${pkgs.gcc}/bin/g++";
# Set include paths
C_INCLUDE_PATH = with pkgs;
lib.concatStringsSep ":" [ "${glibc.dev}/include" ];
CPLUS_INCLUDE_PATH = with pkgs;
lib.concatStringsSep ":" [ "${glibc.dev}/include" ];
PKG_CONFIG_PATH = with pkgs;
lib.concatStringsSep ":" [ "${wayland.dev}/lib/pkgconfig" ];
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
RUST_SRC_PATH =
"${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
};
shellHook = ''
export PS1="($(basename $(pwd)))> ";
alias ee=exit
echo "[INFO] ✨ Rust development environment with Slint GUI framework support is ready!"
echo "[INFO] 📦 Rust version: $(rustc --version)"
echo "[INFO] 📦 C++ compiler: $(g++ --version | head -n1)"
echo "[INFO] 📦 Clang version: ${pkgs.llvmPackages.clang.version}"
echo "[INFO] 📦 Qt version: ${pkgs.qt6.qtbase.version}"
'';
};
};
}