-
Notifications
You must be signed in to change notification settings - Fork 4
/
flake.nix
75 lines (73 loc) · 2.87 KB
/
flake.nix
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
{
inputs.fenix = {
inputs.nixpkgs.follows = "nixpkgs";
url = github:nix-community/fenix;
};
inputs.rust-manifest = {
flake = false;
url = "https://static.rust-lang.org/dist/2024-02-29/channel-rust-nightly.toml";
};
inputs.flake-utils.url = github:numtide/flake-utils;
description = "runa - wayland compositor toolkit";
outputs = { self, nixpkgs, fenix, flake-utils, ... } @ inputs: flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; overlays = [ fenix.overlays.default ]; };
rust-toolchain = (pkgs.fenix.fromManifestFile inputs.rust-manifest).withComponents [
"rustfmt"
"rust-src"
"clippy"
"rustc"
"cargo"
];
rustPlatform = pkgs.makeRustPlatform {
cargo = rust-toolchain;
rustc = rust-toolchain;
};
runtimeDependencies = (with pkgs; [ libGL vulkan-loader ]) ++
(with pkgs.xorg; [ libX11 libXdmcp libXrender libXcursor libXau libxcb libXfixes libXrandr libXext libXi pkgs.libxkbcommon ]);
in
with pkgs; {
packages = rec {
crescent = rustPlatform.buildRustPackage rec {
inherit runtimeDependencies;
pname = "crescent";
version = "0.1.0";
src = ./.;
buildInputs = [ libxkbcommon gccForLibs.lib ];
nativeBuildInputs = [ autoPatchelfHook ];
postUnpack = ''
echo $(pwd)
ls $sourceRoot/runa-wayland-protocols/spec
cp -v ${cargoLock.lockFile} $sourceRoot/Cargo.lock
'';
cargoLock.lockFile = ./nix/Cargo.lock;
LIBCLANG_PATH = lib.makeLibraryPath [ llvmPackages_17.libclang.lib ];
BINDGEN_EXTRA_CLANG_ARGS =
# Includes with normal include path
(builtins.map (a: ''-I"${a}/include"'') [
linuxHeaders
]) ++ [
''-isystem "${pkgs.llvmPackages_latest.libclang.lib}/lib/clang/${lib.versions.major pkgs.llvmPackages_latest.libclang.version}/include"''
''-isystem "${glibc.dev}/include"''
];
};
default = crescent;
};
devShells.default = mkShell {
nativeBuildInputs = [ pkg-config cmake rust-toolchain mold cargo-bloat ];
buildInputs = [ libxkbcommon ];
shellHook = ''
export LD_LIBRARY_PATH="${lib.makeLibraryPath (runtimeDependencies ++ [ wayland ])}:$LD_LIBRARY_PATH"
'';
LIBCLANG_PATH = lib.makeLibraryPath [ llvmPackages_17.libclang.lib ];
BINDGEN_EXTRA_CLANG_ARGS =
# Includes with normal include path
(builtins.map (a: ''-I"${a}/include"'') [
linuxHeaders
]) ++ [
''-isystem "${pkgs.llvmPackages_latest.libclang.lib}/lib/clang/${lib.versions.major pkgs.llvmPackages_latest.libclang.version}/include"''
''-isystem "${glibc.dev}/include"''
];
};
});
}