nixpkgs/pkgs/applications/misc/phoc/default.nix
Rodney Lorrimar ea05237d93 phoc: Provide patched wlroots as mkDerivation attribute
This lets users more easily override phoc and its wlroots.

Also the wlroots patch is taken from the phoc source tree, rather than
from GitLab. This way, the patch is automatically updated along with
source updates.
2024-02-07 20:10:15 +11:00

91 lines
2.0 KiB
Nix

{ lib
, stdenv
, stdenvNoCC
, fetchurl
, meson
, ninja
, pkg-config
, python3
, wrapGAppsHook
, libinput
, gnome
, gnome-desktop
, glib
, gtk3
, wayland
, libdrm
, libxkbcommon
, wlroots
, xorg
, directoryListingUpdater
, nixosTests
}:
stdenv.mkDerivation (finalAttrs: {
pname = "phoc";
version = "0.31.0";
src = fetchurl {
# This tarball includes the meson wrapped subproject 'gmobile'.
url = with finalAttrs; "https://sources.phosh.mobi/releases/${pname}/${pname}-${version}.tar.xz";
hash = "sha256-P7Bs9JMv6KNKo4d2ID0/Ba4+Nel6DMn8o4I7EDvY4vY=";
};
nativeBuildInputs = [
meson
ninja
pkg-config
python3
wrapGAppsHook
];
buildInputs = [
libdrm.dev
libxkbcommon
libinput
glib
gtk3
gnome-desktop
# For keybindings settings schemas
gnome.mutter
wayland
finalAttrs.wlroots
xorg.xcbutilwm
];
mesonFlags = ["-Dembed-wlroots=disabled"];
# Patch wlroots to remove a check which crashes Phosh.
# This patch can be found within the phoc source tree.
wlroots = wlroots.overrideAttrs (old: {
patches = (old.patches or []) ++ [
(stdenvNoCC.mkDerivation {
name = "0001-Revert-layer-shell-error-on-0-dimension-without-anch.patch";
inherit (finalAttrs) src;
preferLocalBuild = true;
allowSubstitutes = false;
phases = "unpackPhase installPhase";
installPhase = "cp subprojects/packagefiles/wlroots/$name $out";
})
];
});
postPatch = ''
chmod +x build-aux/post_install.py
patchShebangs build-aux/post_install.py
'';
passthru = {
tests.phosh = nixosTests.phosh;
updateScript = directoryListingUpdater { };
};
meta = with lib; {
description = "Wayland compositor for mobile phones like the Librem 5";
homepage = "https://gitlab.gnome.org/World/Phosh/phoc";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ masipcat tomfitzhenry zhaofengli ];
platforms = platforms.linux;
};
})