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.
This commit is contained in:
Rodney Lorrimar 2024-02-02 13:07:26 +08:00 committed by tomf
parent d15652a1af
commit ea05237d93

View File

@ -1,7 +1,7 @@
{ lib { lib
, stdenv , stdenv
, stdenvNoCC
, fetchurl , fetchurl
, fetchpatch
, meson , meson
, ninja , ninja
, pkg-config , pkg-config
@ -21,25 +21,13 @@
, nixosTests , nixosTests
}: }:
let stdenv.mkDerivation (finalAttrs: {
phocWlroots = wlroots.overrideAttrs (old: {
patches = (old.patches or []) ++ [
# Revert "layer-shell: error on 0 dimension without anchors"
# https://source.puri.sm/Librem5/phosh/-/issues/422
(fetchpatch {
name = "0001-Revert-layer-shell-error-on-0-dimension-without-anch.patch";
url = "https://gitlab.gnome.org/World/Phosh/phoc/-/raw/acb17171267ae0934f122af294d628ad68b09f88/subprojects/packagefiles/wlroots/0001-Revert-layer-shell-error-on-0-dimension-without-anch.patch";
hash = "sha256-uNJaYwkZImkzNUEqyLCggbXAoIRX5h2eJaGbSHj1B+o=";
})
];
});
in stdenv.mkDerivation rec {
pname = "phoc"; pname = "phoc";
version = "0.31.0"; version = "0.31.0";
src = fetchurl { src = fetchurl {
# This tarball includes the meson wrapped subproject 'gmobile'. # This tarball includes the meson wrapped subproject 'gmobile'.
url = "https://sources.phosh.mobi/releases/phoc/phoc-${version}.tar.xz"; url = with finalAttrs; "https://sources.phosh.mobi/releases/${pname}/${pname}-${version}.tar.xz";
hash = "sha256-P7Bs9JMv6KNKo4d2ID0/Ba4+Nel6DMn8o4I7EDvY4vY="; hash = "sha256-P7Bs9JMv6KNKo4d2ID0/Ba4+Nel6DMn8o4I7EDvY4vY=";
}; };
@ -61,12 +49,27 @@ in stdenv.mkDerivation rec {
# For keybindings settings schemas # For keybindings settings schemas
gnome.mutter gnome.mutter
wayland wayland
phocWlroots finalAttrs.wlroots
xorg.xcbutilwm xorg.xcbutilwm
]; ];
mesonFlags = ["-Dembed-wlroots=disabled"]; 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 = '' postPatch = ''
chmod +x build-aux/post_install.py chmod +x build-aux/post_install.py
patchShebangs build-aux/post_install.py patchShebangs build-aux/post_install.py
@ -84,4 +87,4 @@ in stdenv.mkDerivation rec {
maintainers = with maintainers; [ masipcat tomfitzhenry zhaofengli ]; maintainers = with maintainers; [ masipcat tomfitzhenry zhaofengli ];
platforms = platforms.linux; platforms = platforms.linux;
}; };
} })