-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathflake.nix
More file actions
240 lines (219 loc) · 7.28 KB
/
flake.nix
File metadata and controls
240 lines (219 loc) · 7.28 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
{
description = "A collection of plugins for northstar related to bots";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-win.url = "github:nixos/nixpkgs/24.11";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils = {
url = "github:numtide/flake-utils";
};
catornot-flakes = {
url = "github:catornot/catornot-flakes";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
nixpkgs-win,
flake-utils,
rust-overlay,
catornot-flakes,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
native-pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
pkgs = import nixpkgs-win {
inherit system;
overlays = [ (import rust-overlay) ];
crossSystem = {
config = "x86_64-w64-mingw32";
libc = "msvcrt";
};
config.microsoftVisualStudioLicenseAccepted = true;
};
toolchain-win = (pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml);
toolchain-linux = (
native-pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml
);
# toolchain-linux = native-pkgs.pkgsBuildBuild.rust-bin.stable.latest.default;
in
rec {
formatter = native-pkgs.nixfmt-tree;
packages =
let
version = "0.1.7";
in
let
mkPluginBuildType =
plugin: buildType:
pkgs.callPackage ./expressions/plugins.nix {
rust-bin = rust-overlay.lib.mkRustBin { } pkgs.buildPackages;
inherit plugin version buildType;
};
mkPlugin = plugin: mkPluginBuildType plugin "release";
in
{
bp-ort = mkPluginBuildType "bp_ort" "debug";
ranim = mkPlugin "ranim";
octbots = mkPlugin "octbots";
serialized-io = mkPlugin "serialized_io";
packaged-mod = native-pkgs.callPackage ./expressions/packaged-mod.nix {
inherit (self.packages.${system}) mod;
inherit version;
};
mod = native-pkgs.callPackage ./expressions/mod.nix {
plugins = native-pkgs.symlinkJoin {
name = "plugins";
# must have at least one plugin
paths = with self.packages.${system}; [
bp-ort
octbots
ranim
serialized-io
# bspeater-win # to allow users to compile navmeshes locally
];
};
inherit version;
};
bspeater = native-pkgs.callPackage ./expressions/bspeater.nix {
rust-bin = rust-overlay.lib.mkRustBin { } native-pkgs.buildPackages;
inherit version;
graphical = false;
};
bspeater-graphical = native-pkgs.callPackage ./expressions/bspeater.nix {
rust-bin = rust-overlay.lib.mkRustBin { } native-pkgs.buildPackages;
inherit version;
graphical = true;
};
bspeater-win = pkgs.callPackage ./expressions/bspeater.nix {
rust-bin = rust-overlay.lib.mkRustBin { } native-pkgs.buildPackages;
inherit version;
graphical = false;
};
default = self.packages.${system}.bp-ort;
tracy = native-pkgs.writeShellApplication {
name = "tracy";
runtimeInputs = [
native-pkgs.tracy
];
text = ''
capture -o target/trace.tracy
'';
};
tracy-open = native-pkgs.writeShellApplication {
name = "tracy-open";
runtimeInputs = [
native-pkgs.tracy
];
text = ''
DISPLAY=:0 :w
tracy target/trace.tracy
'';
};
navmeshes =
let
bspeater = self.packages.${system}.bspeater;
titanfall2 = catornot-flakes.packages.${system}.titanfall2;
tf2vpk = catornot-flakes.packages.${system}.tf2vpk;
in
native-pkgs.callPackage ./expressions/navmeshes.nix { inherit bspeater titanfall2 tf2vpk; };
};
devShells = {
win-shell = pkgs.mkShell rec {
nativeBuildInputs = with pkgs; [
native-pkgs.bacon
toolchain-win
pkg-config
];
buildInputs = with pkgs; [
windows.mingw_w64_headers
# windows.mcfgthreads
windows.pthreads
];
LD_LIBRARY_PATH = nixpkgs.lib.makeLibraryPath buildInputs;
PATH = nixpkgs.lib.makeLibraryPath buildInputs;
WINEPATH = nixpkgs.lib.makeLibraryPath buildInputs;
};
native-shell = pkgs.mkShell rec {
nativeBuildInputs = with native-pkgs; [
cargo-deny
cargo-audit
bacon
toolchain-linux
clang
cmake
cmakeCurses
pkg-config
];
buildInputs = with native-pkgs; [
stdenv.cc
zstd
libxkbcommon
vulkan-loader
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
alsa-lib-with-plugins
wayland
glfw
udev
pkg-config
];
runtimeDependencies = with native-pkgs; [
libgcc
stdenv.cc
zstd
libxkbcommon
vulkan-loader
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
alsa-lib-with-plugins
wayland
glfw
udev
];
LD_LIBRARY_PATH = nixpkgs.lib.makeLibraryPath runtimeDependencies;
PATH = nixpkgs.lib.makeLibraryPath runtimeDependencies;
# adding the export worked!
shellHook = ''
export CC=clang
export CXX=clang++
export CMAKE=${native-pkgs.cmake}/bin/cmake
export WGPU_ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER=1
export WGPU_BACKEND=vulkan
export RUST_BACKTRACE=1
'';
};
default = pkgs.mkShell rec {
shellHook = ''
echo "this flake provdies multiple shells choose one"
echo "nix develop .#win-shell # provides tooling to build the plugins"
echo "nix develop .#native-shell # provides tooling to build native tooling"
'';
};
};
nix.settings = {
substituters = [
"https://cache.nixos.org/"
"https://nix-community.cachix.org"
];
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
}
);
}