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
|
{
lib,
stdenv,
fetchFromGitLab,
meson,
ninja,
pkg-config,
wayland-scanner,
libGL,
wayland,
wayland-protocols,
libinput,
libxkbcommon,
pixman,
libcap,
libgbm,
libxcb-wm,
libxcb-render-util,
libxcb-image,
libxcb-errors,
libx11,
hwdata,
seatd,
vulkan-loader,
glslang,
libliftoff,
libdisplay-info,
lcms2,
evdev-proto,
nixosTests,
testers,
enableXWayland ? true,
xwayland ? null,
}:
let
generic =
{
version,
hash,
extraBuildInputs ? [ ],
extraNativeBuildInputs ? [ ],
patches ? [ ],
postPatch ? "",
}:
stdenv.mkDerivation (finalAttrs: {
pname = "wlroots";
inherit version;
inherit enableXWayland;
src = fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "wlroots";
repo = "wlroots";
rev = finalAttrs.version;
inherit hash;
};
inherit patches postPatch;
# $out for the library and $examples for the example programs (in examples):
outputs = [
"out"
"examples"
];
strictDeps = true;
depsBuildBuild = [ pkg-config ];
nativeBuildInputs = [
meson
ninja
pkg-config
wayland-scanner
glslang
hwdata
]
++ extraNativeBuildInputs;
propagatedBuildInputs = [
# The headers of wlroots #include <libinput.h>, and consumers of `wlroots` need not add it explicitly, hence we propagate it.
libinput
];
buildInputs = [
libliftoff
libdisplay-info
libGL
libxkbcommon
libgbm
pixman
seatd
vulkan-loader
wayland
wayland-protocols
libx11
libxcb-errors
libxcb-image
libxcb-render-util
libxcb-wm
lcms2
]
++ lib.optional stdenv.hostPlatform.isLinux libcap
++ lib.optional stdenv.hostPlatform.isFreeBSD evdev-proto
++ lib.optional finalAttrs.enableXWayland xwayland
++ extraBuildInputs;
mesonFlags = [
(lib.mesonEnable "xwayland" finalAttrs.enableXWayland)
]
# The other allocator, udmabuf, is a linux-specific API
++ lib.optionals (!stdenv.hostPlatform.isLinux) [
(lib.mesonOption "allocators" "gbm")
];
postFixup = ''
# Install ALL example programs to $examples:
# screencopy dmabuf-capture input-inhibitor layer-shell idle-inhibit idle
# screenshot output-layout multi-pointer rotation tablet touch pointer
# simple
mkdir -p $examples/bin
cd ./examples
for binary in $(find . -executable -type f -printf '%P\n' | grep -vE '\.so'); do
cp "$binary" "$examples/bin/wlroots-$binary"
done
'';
# Test via TinyWL (the "minimum viable product" Wayland compositor based on wlroots):
passthru.tests = {
tinywl = nixosTests.tinywl;
pkg-config = testers.hasPkgConfigModules {
package = finalAttrs.finalPackage;
};
};
meta = {
description = "Modular Wayland compositor library";
longDescription = ''
Pluggable, composable, unopinionated modules for building a Wayland
compositor; or about 50,000 lines of code you were going to write anyway.
'';
inherit (finalAttrs.src.meta) homepage;
changelog = "https://gitlab.freedesktop.org/wlroots/wlroots/-/tags/${version}";
license = lib.licenses.mit;
platforms = lib.platforms.linux ++ lib.platforms.freebsd;
maintainers = with lib.maintainers; [
wineee
doronbehar
];
pkgConfigModules = [
(
if lib.versionOlder finalAttrs.version "0.18" then
"wlroots"
else
"wlroots-${lib.versions.majorMinor finalAttrs.version}"
)
];
};
});
in
{
wlroots_0_19 = generic {
version = "0.19.3";
hash = "sha256-J+wSVUtuizaCyCn523chFbE8VtbPjyu5XYv5eLT+GM0=";
};
wlroots_0_20 = generic {
version = "0.20.0";
hash = "sha256-hVJlJiJK6+9RkgkmQzUzb8ypVMqsNhbQG6KfeCvxtb0=";
};
}
|