aboutsummaryrefslogtreecommitdiffhomepage
path: root/default.nix
blob: a5abdd5d3216a2f5d6e533a8d6ceda76e9924533 (plain)
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
{
  lib,
  stdenv,
  fetchFromGitHub,
  pkg-config,
  cmake,
  ninja,
  libdrm,
  libinput,
  libxcb,
  libxkbcommon,
  mesa,
  mount,
  pango,
  wayland,
  wayland-protocols,
  wayland-scanner,
  wlroots,
  xcbutilwm,
  xwayland,
  enableXWayland ? true,
  version ? "git",
}:
stdenv.mkDerivation {
  pname = "hyprland";
  inherit version;
  src = ./.;

  nativeBuildInputs = [
    cmake
    ninja
    pkg-config
  ];

  buildInputs =
    [
      libdrm
      libinput
      libxcb
      libxkbcommon
      mesa
      pango
      wayland
      wayland-protocols
      wayland-scanner
      (wlroots.override {inherit enableXWayland;})
      xcbutilwm
    ]
    ++ lib.optional enableXWayland xwayland;

  cmakeFlags =
    ["-DCMAKE_BUILD_TYPE=Release"]
    ++ lib.optional (!enableXWayland) "-DNO_XWAYLAND=true";

  prePatch = ''
    make config
  '';

  postBuild = ''
    pushd ../hyprctl
    make all
    popd
  '';

  installPhase = ''
    pushd ..
    install -Dm644 ./example/hyprland.desktop -t $out/share/wayland-sessions
    install -Dm755 ./build/Hyprland -t $out/bin
    install -Dm755 ./hyprctl/hyprctl -t $out/bin
    install -Dm644 ./assets/* -t $out/share/hyprland
    popd
  '';

  passthru.providedSessions = ["hyprland"];

  meta = with lib; {
    homepage = "https://github.com/vaxerski/Hyprland";
    description = "A dynamic tiling Wayland compositor that doesn't sacrifice on its looks";
    license = licenses.bsd3;
    platforms = platforms.linux;
    mainProgram = "Hyprland";
  };
}