about summary refs log tree commit diff
path: root/pkgs/applications/window-managers/hyprwm/hyprland/default.nix
blob: ca9565d915a29031861ac3cf5c420cf6d537c6c1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
{ lib
, stdenv
, fetchFromGitHub
, fetchFromGitLab
, cmake
, libdrm
, libinput
, libxcb
, libxkbcommon
, mesa
, pango
, pkg-config
, wayland
, wayland-protocols
, wayland-scanner
, wlroots
, xcbutilwm
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "hyprland";
  version = "0.6.1beta";

  src = fetchFromGitHub {
    owner = "hyprwm";
    repo = "Hyprland";
    rev = "v${finalAttrs.version}";
    hash = "sha256-0Msqe2ErAJvnO1zHoB2k6TkDhTYnHRGkvJrfSG12dTU=";
  };

  nativeBuildInputs = [
    cmake
    pkg-config
    wayland-scanner
  ];

  buildInputs = [
    libdrm
    libinput
    libxcb
    libxkbcommon
    mesa
    pango
    wayland
    wayland-protocols
    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
  '';

  preConfigure = ''
    make protocols
  '';

  postBuild = ''
    pushd ../hyprctl
    ${stdenv.cc.targetPrefix}c++ -std=c++20 -w ./main.cpp -o ./hyprctl
    popd
  '';

  installPhase = ''
    runHook preInstall

    install -Dm755 ../hyprctl/hyprctl ./Hyprland -t $out/bin

    runHook postInstall
  '';

  meta = with lib; {
    inherit (finalAttrs.src.meta) homepage;
    description = "A dynamic tiling Wayland compositor that doesn't sacrifice on its looks";
    license = licenses.bsd3;
    maintainers = with maintainers; [ wozeparrot ];
    inherit (wayland.meta) platforms;
    mainProgram = "Hyprland";
  };
})