-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
112 lines (100 loc) · 3.15 KB
/
Copy pathflake.nix
File metadata and controls
112 lines (100 loc) · 3.15 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
{
description = "Flake to manage bevy-ffmpeg dependencies";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpkgs,
flake-utils,
rust-overlay,
}:
flake-utils.lib.eachDefaultSystem
(
system: let
overlays = [(import rust-overlay)];
pkgs = import nixpkgs {
inherit system overlays;
};
libs = with pkgs; [
libGLU
libGL
openssl
# needed for creating a window :D
wayland
wayland-scanner
wayland-protocols
egl-wayland
# Bevy related
# Audio (Linux only)
alsa-lib
# Cross Platform 3D Graphics API
vulkan-loader
# For debugging around vulkan
vulkan-tools
# Other dependencies
libudev-zero
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
libxkbcommon
# Ffmpeg related
(ffmpeg.override {
ffmpegVariant = "headless";
})
libclang
(rust-bin.beta.latest.default.override {
extensions = ["rust-src" "rust-analyzer"];
})
];
nativeBuildInputs = with pkgs; [
clang-tools
pkg-config
cargo
];
build_project = optimize:
pkgs.rustPlatform.buildRustPackage {
pname = "bevy-ffmpeg";
version = "1.0.0";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
buildInputs = libs;
nativeBuildInputs = nativeBuildInputs;
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath libs;
CMAKE_PREFIX_PATH = pkgs.lib.makeLibraryPath libs;
# These needed to be added for ffmpeg to compile
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
BINDGEN_EXTRA_CLANG_ARGS = "-isystem ${pkgs.libclang.lib}/lib/clang/${pkgs.libclang.version}/include -isystem ${pkgs.glibc.dev}/include";
buildType =
if optimize
then "release"
else "debug";
meta = with pkgs.lib; {
description = "Apply quick pixel effects to images/videos.";
license = licenses.mit;
maintainers = with maintainers; [yunusey];
platforms = platforms.linux;
};
};
in {
packages = rec {
default = release;
debug = build_project false;
release = build_project true;
};
devShells.default = pkgs.mkShell {
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath libs;
CMAKE_PREFIX_PATH = pkgs.lib.makeLibraryPath libs;
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
BINDGEN_EXTRA_CLANG_ARGS = "-isystem ${pkgs.libclang.lib}/lib/clang/${pkgs.libclang.version}/include -isystem ${pkgs.glibc.dev}/include";
buildInputs = libs;
nativeBuildInputs = nativeBuildInputs ++ libs;
};
}
);
}