-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
103 lines (87 loc) · 2.75 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
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
{
description = "A Nix-flake-based C/C++ development environment";
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
outputs = { nixpkgs, ... }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in
{
devShells = forEachSupportedSystem
({ pkgs }:
let
vk-bootstrap-new = pkgs.stdenv.mkDerivation
rec {
pname = "vk-bootstrap";
version = "1.3.290";
outputs = [ "out" "dev" ];
src = pkgs.fetchFromGitHub {
owner = "charles-lunarg";
repo = "vk-bootstrap";
rev = "v${version}";
hash = "sha256-ibu+m6NfjB7A1aFPALDmf32sH8yTA551XCmjbTSCwY8=";
};
nativeBuildInputs = [ pkgs.cmake ];
buildInputs = [ pkgs.vulkan-headers pkgs.glfw pkgs.catch2_3 ];
cmakeFlags = [
"-DVK_BOOTSTRAP_TEST=OFF"
];
meta = {
description = "Vulkan Bootstrapping Library";
homepage = "https://github.com/charles-lunarg/vk-bootstrap";
};
};
imgui-vulkan = pkgs.imgui.override {
IMGUI_BUILD_VULKAN_BINDING = true;
};
common = with pkgs;[
# C++
clang-tools
cmake
codespell
conan
cppcheck
doxygen
gtest
lcov
vcpkg
vcpkg-tool
# vulkan
vulkan-headers
vulkan-loader
vulkan-validation-layers
vulkan-tools
# Other tools
glfw
imgui-vulkan
# Helpers
vk-bootstrap-new
];
scripts = with pkgs; [
(writeScriptBin "build" ''
cd build
make
'')
(writeScriptBin "clean" ''
rm -rf build
mkdir build
cd build
cmake ..
'')
(writeScriptBin "start" ''
./build/bin/app
'')
];
in
{
default = pkgs.mkShell
{
packages = common ++ scripts;
VULKAN_SDK = "${pkgs.vulkan-headers}";
LD_LIBRARY_PATH = "${pkgs.vulkan-headers}/lib:${pkgs.vulkan-loader}/lib";
};
});
};
}