Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
214 lines (214 loc) · 6.27 KB
/
Copy pathflake.nix
File metadata and controls
214 lines (214 loc) · 6.27 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
{
description = "Resonance development and asset conversion environment";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.qlog = {
url = "github:qbaylogic/qlog";
flake = false;
};
outputs =
{ nixpkgs, qlog, ... }:
let
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
eachSystem = nixpkgs.lib.genAttrs systems;
in
{
packages = eachSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
in
{
dolphin-observer = import ./nix/dolphin.nix { inherit pkgs; };
}
);
devShells = eachSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
dolphinObserver = import ./nix/dolphin.nix { inherit pkgs; };
# Upstream's uv.lock omits colorama; package its declared dependencies.
qlogPackage = pkgs.python3Packages.buildPythonApplication {
pname = "qlog";
version = (builtins.fromTOML (builtins.readFile "${qlog}/pyproject.toml")).project.version;
src = qlog;
pyproject = true;
build-system = [ pkgs.python3Packages.setuptools ];
dependencies = with pkgs.python3Packages; [
colorama
cssselect
lxml
pyyaml
requests
];
pythonImportsCheck = [ "qlog.cli" ];
};
linkerEnv = pkgs.lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
"CARGO_TARGET_${
pkgs.lib.toUpper (builtins.replaceStrings [ "-" ] [ "_" ] pkgs.stdenv.hostPlatform.rust.rustcTarget)
}_LINKER" =
pkgs.writeShellScript "resonance-linker" ''
exec ${pkgs.clang}/bin/clang "$@" -fuse-ld=${pkgs.mold}/bin/mold
'';
};
platformLibraries =
with pkgs;
lib.optionals stdenv.hostPlatform.isLinux [
alsa-lib
dbus
udev
vulkan-loader
libx11
libxcursor
libxi
libxrandr
libxkbcommon
wayland
];
common =
with pkgs;
[
rustc
cargo
rustfmt
clippy
rust-analyzer
rustPlatform.rustLibSrc
clang
cmake
ninja
pkg-config
git
gh
qlogPackage
ripgrep
jq
(python3.withPackages (p: [
p.numpy
p.scipy
p.pillow
]))
lz4
dolphinObserver
nodejs
typescript
esbuild
cargo-nextest
lldb
nixfmt
]
++ platformLibraries
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux [
pkgs.xorg-server
pkgs.xdotool
];
shell =
extras:
pkgs.mkShell (
{
packages = common ++ extras;
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}/lib/rustlib/src/rust/library";
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (
platformLibraries
++ [
pkgs.lz4
]
);
}
// linkerEnv
);
in
{
default = shell [ ];
art = shell [ pkgs.blender ];
website = pkgs.mkShell {
packages = with pkgs; [
rustc
cargo
rustfmt
clippy
sqlite
];
};
website-cross = pkgs.mkShell {
packages = with pkgs; [
rustup
cargo-zigbuild
binutils
file
];
};
}
);
formatter = eachSystem (system: nixpkgs.legacyPackages.${system}.nixfmt);
checks = eachSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
source = pkgs.lib.fileset.toSource {
root = ./.;
fileset = pkgs.lib.fileset.unions [
./Cargo.toml
./Cargo.lock
./LICENSE
./rust-toolchain.toml
./apps
./crates
./scripts
./mods
./tools/oracle
];
};
in
{
format =
pkgs.runCommand "resonance-format"
{
nativeBuildInputs = [
pkgs.cargo
pkgs.rustfmt
];
}
''
cd ${source}
cargo fmt --all --check
touch "$out"
'';
workspace = pkgs.rustPlatform.buildRustPackage {
pname = "resonance-workspace-check";
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).workspace.package.version;
src = source;
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes."ffv1-0.0.0" = "sha256-/ENsKVXIivMPsubqzfKUdGE/4rz8jev3LO/L+/4EVjY=";
outputHashes."texture-compressor-0.2.4" = "sha256-tE5N/hFVKwD8PJxaPM/Ozj1LgPBb4UfM2CIi1X/TaTg=";
# Every wgpu crate comes from this one fork commit; update with Cargo.lock.
outputHashes."wgpu-core-30.0.1" = "sha256-VtaCG51VHQJyUWmwRgMT1A3d8pobnNTF0tTtFgMS1z8=";
};
nativeBuildInputs = [
pkgs.pkg-config
pkgs.cmake
];
buildInputs = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux [
pkgs.alsa-lib
pkgs.dbus
pkgs.udev
pkgs.vulkan-loader
pkgs.libx11
pkgs.libxcursor
pkgs.libxi
pkgs.libxrandr
pkgs.libxkbcommon
pkgs.wayland
];
cargoBuildFlags = [ "--workspace" ];
cargoTestFlags = [ "--workspace" ];
doCheck = true;
};
}
);
};
}