summary refs log tree commit diff
path: root/pkgs/applications/window-managers/sway/default.nix
blob: 2c94f7f6fecc8abf6e8a79fd5ce7877634288e76 (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
{ stdenv, fetchFromGitHub
, makeWrapper, cmake, pkgconfig, asciidoc, libxslt, docbook_xsl
, wayland, wlc, libxkbcommon, pixman, fontconfig, pcre, json_c, dbus_libs
, pango, cairo, libinput, libcap, xwayland, pam, gdk_pixbuf, libpthreadstubs
, libXdmcp
}:

let
  # TODO: Sway 0.14.0 with wlc 0.0.10 segfaults
  version = "0.13.0";
in stdenv.mkDerivation rec {
  name = "sway-${version}";

  src = fetchFromGitHub {
    owner = "Sircmpwn";
    repo = "sway";
    rev = "${version}";
    sha256 = "1vgk4rl51nx66yzpwg4yhnbj7wc30k5q0hh5lf8y0i1nvpal0p3q";
  };

  nativeBuildInputs = [
    makeWrapper cmake pkgconfig
    asciidoc libxslt docbook_xsl
  ];
  buildInputs = [
    wayland wlc libxkbcommon pixman fontconfig pcre json_c dbus_libs
    pango cairo libinput libcap xwayland pam gdk_pixbuf libpthreadstubs
    libXdmcp
  ];

  patchPhase = ''
    sed -i s@/etc/sway@$out/etc/sway@g CMakeLists.txt;
  '';

  makeFlags = "PREFIX=$(out)";
  cmakeFlags = "-DVERSION=${version}";
  installPhase = "PREFIX=$out make install";

  LD_LIBRARY_PATH = stdenv.lib.makeLibraryPath [ wlc dbus_libs ];
  preFixup = ''
    wrapProgram $out/bin/sway \
      --prefix LD_LIBRARY_PATH : "${LD_LIBRARY_PATH}";
  '';

  meta = with stdenv.lib; {
    description = "i3-compatible window manager for Wayland";
    homepage    = http://swaywm.org;
    license     = licenses.mit;
    platforms   = platforms.linux;
    maintainers = with maintainers; [ primeos ]; # Trying to keep it up-to-date.
  };
}