From 2675c17f090288c02df77dd1f55e04e811b5683a Mon Sep 17 00:00:00 2001 From: AndersonTorres Date: Sun, 16 Oct 2022 22:23:24 -0300 Subject: [PATCH] hyprland: refactor - Moves the overrided wlroots inside the expression --- .../window-managers/hyprland/default.nix | 45 ++++++++++++------- pkgs/top-level/all-packages.nix | 13 +----- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/pkgs/applications/window-managers/hyprland/default.nix b/pkgs/applications/window-managers/hyprland/default.nix index 50b52a01d604..ca9565d915a2 100644 --- a/pkgs/applications/window-managers/hyprland/default.nix +++ b/pkgs/applications/window-managers/hyprland/default.nix @@ -1,14 +1,15 @@ { lib , stdenv , fetchFromGitHub +, fetchFromGitLab , cmake -, pkg-config , libdrm , libinput , libxcb , libxkbcommon , mesa , pango +, pkg-config , wayland , wayland-protocols , wayland-scanner @@ -16,16 +17,15 @@ , xcbutilwm }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "hyprland"; version = "0.6.1beta"; - # When updating Hyprland, the overridden wlroots commit must be bumped to match the commit upstream uses. src = fetchFromGitHub { owner = "hyprwm"; - repo = pname; - rev = "v${version}"; - sha256 = "sha256-0Msqe2ErAJvnO1zHoB2k6TkDhTYnHRGkvJrfSG12dTU="; + repo = "Hyprland"; + rev = "v${finalAttrs.version}"; + hash = "sha256-0Msqe2ErAJvnO1zHoB2k6TkDhTYnHRGkvJrfSG12dTU="; }; nativeBuildInputs = [ @@ -43,13 +43,26 @@ stdenv.mkDerivation rec { pango wayland wayland-protocols - wlroots xcbutilwm + ] + ++ [ + # INFO: When updating src, remember to synchronize this wlroots with the + # exact commit used by upstream + (wlroots.overrideAttrs (_: { + version = "unstable-2022-06-07"; + src = fetchFromGitLab { + domain = "gitlab.freedesktop.org"; + owner = "wlroots"; + repo = "wlroots"; + rev = "b89ed9015c3fbe8d339e9d65cf70fdca6e5645bc"; + hash = "sha256-8y3u8CoigjoZOVbA2wCWBHlDNEakv0AVxU46/cOC00s="; + }; + })) ]; # build with system wlroots postPatch = '' - sed -Ei 's/"\.\.\/wlroots\/include\/([a-zA-Z0-9./_-]+)"/<\1>/g' src/includes.hpp + sed -Ei 's|"\.\./wlroots/include/([a-zA-Z0-9./_-]+)"|<\1>|g' src/includes.hpp ''; preConfigure = '' @@ -58,22 +71,24 @@ stdenv.mkDerivation rec { postBuild = '' pushd ../hyprctl - $CXX -std=c++20 -w ./main.cpp -o ./hyprctl + ${stdenv.cc.targetPrefix}c++ -std=c++20 -w ./main.cpp -o ./hyprctl popd ''; installPhase = '' - mkdir -p $out/bin - install -m755 ./Hyprland $out/bin - install -m755 ../hyprctl/hyprctl $out/bin + runHook preInstall + + install -Dm755 ../hyprctl/hyprctl ./Hyprland -t $out/bin + + runHook postInstall ''; meta = with lib; { - homepage = "https://github.com/vaxerski/Hyprland"; + inherit (finalAttrs.src.meta) homepage; description = "A dynamic tiling Wayland compositor that doesn't sacrifice on its looks"; license = licenses.bsd3; - platforms = platforms.linux; maintainers = with maintainers; [ wozeparrot ]; + inherit (wayland.meta) platforms; mainProgram = "Hyprland"; }; -} +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ac51b9fcc46b..fcefb9d011b7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4218,18 +4218,7 @@ with pkgs; hunt = callPackage ../tools/misc/hunt { }; - hyprland = callPackage ../applications/window-managers/hyprland { - wlroots = wlroots.overrideAttrs (_: { - version = "unstable-2022-06-07"; - src = fetchFromGitLab { - domain = "gitlab.freedesktop.org"; - owner = "wlroots"; - repo = "wlroots"; - rev = "b89ed9015c3fbe8d339e9d65cf70fdca6e5645bc"; - sha256 = "sha256-8y3u8CoigjoZOVbA2wCWBHlDNEakv0AVxU46/cOC00s="; - }; - }); - }; + hyprland = callPackage ../applications/window-managers/hyprland { }; hysteria = callPackage ../tools/networking/hysteria { buildGoModule = buildGo119Module;