about summary refs log tree commit diff
path: root/pkgs/applications/window-managers
diff options
context:
space:
mode:
authorAndersonTorres <torres.anderson.85@protonmail.com>2022-10-16 22:23:24 -0300
committerAndersonTorres <torres.anderson.85@protonmail.com>2022-10-16 23:08:04 -0300
commit2675c17f090288c02df77dd1f55e04e811b5683a (patch)
tree552ff1e8974e10c1a6db7aeebcc3aabdde94ad8a /pkgs/applications/window-managers
parentec9efdb88d423a72a6cd3d85b513ca1914188a7f (diff)
hyprland: refactor
- Moves the overrided wlroots inside the expression
Diffstat (limited to 'pkgs/applications/window-managers')
-rw-r--r--pkgs/applications/window-managers/hyprland/default.nix45
1 files changed, 30 insertions, 15 deletions
diff --git a/pkgs/applications/window-managers/hyprland/default.nix b/pkgs/applications/window-managers/hyprland/default.nix
index 50b52a01d6049..ca9565d915a29 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";
   };
-}
+})