1{
2 lib,
3 stdenv,
4 stdenvNoCC,
5 fetchFromGitLab,
6 meson,
7 ninja,
8 pkg-config,
9 python3,
10 wayland-scanner,
11 wrapGAppsHook3,
12 libinput,
13 gobject-introspection,
14 mutter,
15 gnome-desktop,
16 glib,
17 gtk3,
18 json-glib,
19 wayland,
20 libdrm,
21 libxkbcommon,
22 wlroots_0_17,
23 xorg,
24 directoryListingUpdater,
25 nixosTests,
26 testers,
27 gmobile,
28}:
29
30stdenv.mkDerivation (finalAttrs: {
31 pname = "phoc";
32 version = "0.44.1";
33
34 src = fetchFromGitLab {
35 domain = "gitlab.gnome.org";
36 group = "World";
37 owner = "Phosh";
38 repo = "phoc";
39 rev = "v${finalAttrs.version}";
40 hash = "sha256-Whke7wTRp5NaRauiiQZLjs0pSD1uAyr0aAhlK5e1+Hw=";
41 };
42
43 nativeBuildInputs = [
44 gobject-introspection
45 meson
46 ninja
47 pkg-config
48 python3
49 wayland-scanner
50 wrapGAppsHook3
51 ];
52
53 buildInputs = [
54 libdrm.dev
55 libxkbcommon
56 libinput
57 glib
58 gtk3
59 gnome-desktop
60 # For keybindings settings schemas
61 mutter
62 json-glib
63 wayland
64 finalAttrs.wlroots
65 xorg.xcbutilwm
66 gmobile
67 ];
68
69 mesonFlags = [ "-Dembed-wlroots=disabled" ];
70
71 # Patch wlroots to remove a check which crashes Phosh.
72 # This patch can be found within the phoc source tree.
73 wlroots = wlroots_0_17.overrideAttrs (old: {
74 patches = (old.patches or [ ]) ++ [
75 (stdenvNoCC.mkDerivation {
76 name = "0001-Revert-layer-shell-error-on-0-dimension-without-anch.patch";
77 inherit (finalAttrs) src;
78 preferLocalBuild = true;
79 allowSubstitutes = false;
80 installPhase = "cp subprojects/packagefiles/wlroots/$name $out";
81 })
82 ];
83 });
84
85 passthru = {
86 tests.phosh = nixosTests.phosh;
87 tests.version = testers.testVersion {
88 package = finalAttrs.finalPackage;
89 };
90 updateScript = directoryListingUpdater { };
91 };
92
93 meta = with lib; {
94 description = "Wayland compositor for mobile phones like the Librem 5";
95 mainProgram = "phoc";
96 homepage = "https://gitlab.gnome.org/World/Phosh/phoc";
97 license = licenses.gpl3Plus;
98 maintainers = with maintainers; [
99 masipcat
100 zhaofengli
101 ];
102 platforms = platforms.linux;
103 };
104})