lol
1{
2 stdenv,
3 lib,
4 fetchFromGitLab,
5 nix-update-script,
6 cargo,
7 meson,
8 ninja,
9 rustPlatform,
10 rustc,
11 pkg-config,
12 glib,
13 grass-sass,
14 gtk4,
15 gtksourceview5,
16 lcms2,
17 libadwaita,
18 gst_all_1,
19 desktop-file-utils,
20 appstream-glib,
21 openssl,
22 pipewire,
23 libshumate,
24 wrapGAppsHook4,
25 sqlite,
26 xdg-desktop-portal,
27 libseccomp,
28 glycin-loaders,
29 libwebp,
30}:
31
32stdenv.mkDerivation (finalAttrs: {
33 pname = "fractal";
34 version = "12.1";
35
36 src = fetchFromGitLab {
37 domain = "gitlab.gnome.org";
38 owner = "World";
39 repo = "fractal";
40 tag = finalAttrs.version;
41 hash = "sha256-xeB6N4ljXGzysy5RnDRK1wPiIRUSDcl+5BIdp6NO5ZA=";
42 };
43
44 cargoDeps = rustPlatform.fetchCargoVendor {
45 inherit (finalAttrs) src;
46 hash = "sha256-CHduzW++BYzasFv/x0Q1T7EaTlo1EqYY2gxQJv+ek0A=";
47 };
48
49 patches = [
50 # Disable debug symbols in release builds
51 # The debug symbols are stripped afterwards anyways, and building with them requires extra memory
52 ./disable-debug.patch
53 ];
54
55 postPatch = ''
56 substituteInPlace src/meson.build --replace-fail \
57 "'src' / rust_target / meson.project_name()" \
58 "'src' / '${stdenv.hostPlatform.rust.cargoShortTarget}' / rust_target / meson.project_name()"
59 '';
60
61 # Dirty approach to add patches after cargoSetupPostUnpackHook
62 # We should eventually use a cargo vendor patch hook instead
63 preConfigure = ''
64 pushd ../$(stripHash $cargoDeps)/glycin-2.*
65 patch -p3 < ${glycin-loaders.passthru.glycinPathsPatch}
66 popd
67 '';
68
69 nativeBuildInputs = [
70 glib
71 grass-sass
72 gtk4
73 meson
74 ninja
75 pkg-config
76 rustPlatform.bindgenHook
77 rustPlatform.cargoSetupHook
78 cargo
79 rustc
80 desktop-file-utils
81 appstream-glib
82 wrapGAppsHook4
83 ];
84
85 buildInputs = [
86 glib
87 gtk4
88 gtksourceview5
89 lcms2
90 libadwaita
91 openssl
92 pipewire
93 libshumate
94 sqlite
95 xdg-desktop-portal
96 libseccomp
97 libwebp
98 ]
99 ++ (with gst_all_1; [
100 gstreamer
101 gst-plugins-base
102 gst-plugins-bad
103 gst-plugins-good
104 gst-plugins-rs
105 ]);
106
107 preFixup = ''
108 gappsWrapperArgs+=(
109 --prefix XDG_DATA_DIRS : "${glycin-loaders}/share"
110 )
111 '';
112
113 env.CARGO_BUILD_TARGET = stdenv.hostPlatform.rust.rustcTargetSpec;
114
115 passthru = {
116 updateScript = nix-update-script { };
117 };
118
119 meta = {
120 description = "Matrix group messaging app";
121 homepage = "https://gitlab.gnome.org/World/fractal";
122 changelog = "https://gitlab.gnome.org/World/fractal/-/releases/${finalAttrs.version}";
123 license = lib.licenses.gpl3Plus;
124 teams = [ lib.teams.gnome ];
125 platforms = lib.platforms.linux;
126 mainProgram = "fractal";
127 };
128})