From ea05237d93e7ca8ec101bfe557a34ba29b2725f5 Mon Sep 17 00:00:00 2001 From: Rodney Lorrimar Date: Fri, 2 Feb 2024 13:07:26 +0800 Subject: [PATCH] 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. --- pkgs/applications/misc/phoc/default.nix | 37 +++++++++++++------------ 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/pkgs/applications/misc/phoc/default.nix b/pkgs/applications/misc/phoc/default.nix index bb5dcf91d48d..dff1b179f1c5 100644 --- a/pkgs/applications/misc/phoc/default.nix +++ b/pkgs/applications/misc/phoc/default.nix @@ -1,7 +1,7 @@ { lib , stdenv +, stdenvNoCC , fetchurl -, fetchpatch , meson , ninja , pkg-config @@ -21,25 +21,13 @@ , nixosTests }: -let - 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 { +stdenv.mkDerivation (finalAttrs: { pname = "phoc"; version = "0.31.0"; src = fetchurl { # 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="; }; @@ -61,12 +49,27 @@ in stdenv.mkDerivation rec { # For keybindings settings schemas gnome.mutter wayland - phocWlroots + 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 @@ -84,4 +87,4 @@ in stdenv.mkDerivation rec { maintainers = with maintainers; [ masipcat tomfitzhenry zhaofengli ]; platforms = platforms.linux; }; -} +})