Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
95 lines (91 loc) · 3.14 KB
/
Copy pathflake.nix
File metadata and controls
95 lines (91 loc) · 3.14 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
{
description = "Tracy Profiler";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-compat.url = "github:edolstra/flake-compat";
};
outputs = {
self,
nixpkgs,
...
}: let
parseVersionFieldFromZon = name:
nixpkgs.lib.pipe ./build.zig.zon [
builtins.readFile
(builtins.match ".*\n[[:space:]]*\\.${name}[[:space:]]=[[:space:]]\"([^\"]+)\".*")
builtins.head
];
version = parseVersionFieldFromZon "version";
in
builtins.foldl' nixpkgs.lib.recursiveUpdate {} (
builtins.map (
system: let
pkgs = nixpkgs.legacyPackages.${system};
deps = pkgs.callPackage ./build.zig.zon.nix {};
fs = pkgs.lib.fileset;
in {
formatter.${system} = pkgs.alejandra;
packages.${system} = rec {
default = tracy;
tracy = pkgs.stdenv.mkDerivation {
name = "tracy";
version = version;
meta.mainProgram = "tracy-profiler";
src = fs.toSource {
root = ./.;
fileset = fs.intersection (fs.fromSource ./.) (
fs.unions [
./capture
./csvexport
./import
./include
./manual/tracy.md
./merge
./monitor
./profiler
./public
./server
./tests/tracy
./update
./build.zig
./build.zig.zon
./build.zig.zon.nix
]
);
};
buildInputs = with pkgs;
[curl zstd lz4 freetype gtk3 dbus]
++ lib.optionals (stdenv.hostPlatform.isLinux) [libxkbcommon];
nativeBuildInputs = with pkgs;
[zig_0_17 pkg-config makeWrapper]
++ lib.optionals (stdenv.hostPlatform.isLinux) [wayland-scanner wayland-protocols];
dontSetZigDefaultFlags = true;
zigBuildFlags = [
"--system"
"${deps}"
"-fno-sys=capstone"
"-Dcpu=baseline"
"-Doptimize=ReleaseFast"
"--color"
"off"
];
postFixup = pkgs.lib.optionalString pkgs.stdenv.hostPlatform.isLinux ''
wrapProgram $out/bin/tracy-profiler --prefix LD_LIBRARY_PATH : "${pkgs.lib.makeLibraryPath [pkgs.libglvnd]}"
'';
};
};
devShells.${system}.default = pkgs.mkShell {
buildInputs = with pkgs;
[gtk3 dbus]
++ lib.optionals (stdenv.hostPlatform.isLinux) [libxkbcommon];
nativeBuildInputs = with pkgs; [zig_0_17 pkg-config];
# shellHook = ''
# export XKB_CONFIG_ROOT=${pkgs.xkeyboard_config}/etc/X11/xkb
# export XLOCALEDIR=${pkgs.xorg.libX11.out}/share/X11/locale
# '';
};
}
)
["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]
);
}