about summary refs log tree commit diff
path: root/pkgs/applications/window-managers/hikari/default.nix
blob: 274c75a3c13ce92648c9b82761be1680ae9410b0 (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
{ stdenv, fetchzip,
  pkgconfig, bmake,
  cairo, glib, libevdev, libinput, libxkbcommon, linux-pam, pango, pixman,
  libucl, wayland, wayland-protocols, wlroots,
  features ? {
    gammacontrol = true;
    layershell   = true;
    screencopy   = true;
    xwayland     = true;
  }
}:

let
  pname = "hikari";
  version = "2.0.2";
in

stdenv.mkDerivation {
  inherit pname version;

  src = fetchzip {
    url = "https://hikari.acmelabs.space/releases/${pname}-${version}.tar.gz";
    sha256 = "1a3i01936pw11hrmjmrhzzwpndl1jqjgx376m5m724wd1j9awm68";
  };

  nativeBuildInputs = [ pkgconfig bmake ];

  buildInputs = [
    cairo
    glib
    libevdev
    libinput
    libxkbcommon
    linux-pam
    pango
    pixman
    libucl
    wayland
    wayland-protocols
    wlroots
  ];

  enableParallelBuilding = true;

  # Must replace GNU Make by bmake
  buildPhase = with stdenv.lib; concatStringsSep " " (
    [ "bmake" "-j$NIX_BUILD_CORES" "PREFIX=$out" ]
    ++ optional stdenv.isLinux "WITH_POSIX_C_SOURCE=YES"
    ++ mapAttrsToList (feat: enabled:
         optionalString enabled "WITH_${toUpper feat}=YES"
       ) features
  );

  # Can't suid in nix store
  # Run hikari as root (it will drop privileges as early as possible), or create
  # a systemd unit to give it the necessary permissions/capabilities.
  patchPhase = ''
    substituteInPlace Makefile --replace '4555' '555'
  '';

  installPhase = ''
    bmake \
      PREFIX=$out \
      install
    runHook postInstall
  '';

  meta = with stdenv.lib; {
    description = "Stacking Wayland compositor which is actively developed on FreeBSD but also supports Linux";
    homepage    = "https://hikari.acmelabs.space";
    license     = licenses.bsd2;
    platforms   = platforms.linux ++ platforms.freebsd;
    maintainers = with maintainers; [ jpotier ];
  };
}