about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/window-managers/sway/default.nix
blob: 9fe09ca3241b698640d81232b5944e5ed34b3a05 (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
{ stdenv, lib, fetchFromGitHub, makeWrapper
, meson, ninja
, pkgconfig, scdoc
, wayland, libxkbcommon, pcre, json_c, libevdev, pango, cairo, libinput
, wlroots, wayland-protocols, swaybg

, gdkPixbufSupport ? true, gdk_pixbuf
, xwaylandSupport ? lib.elem "-Dxwayland=enabled" wlroots.mesonFlags
}:

stdenv.mkDerivation rec {
  pname = "sway";
  version = "1.1.1";

  src = fetchFromGitHub {
    owner = "swaywm";
    repo = "sway";
    rev = version;
    sha256 = "0yhn9zdg9mzfhn97c440lk3pw6122nrhx0is5sqmvgr6p814f776";
  };

  patches = [
    ./sway-config-no-nix-store-references.patch
    ./load-configuration-from-etc.patch
  ];

  nativeBuildInputs = [ pkgconfig meson ninja scdoc makeWrapper ];

  buildInputs = [
    wayland libxkbcommon pcre json_c libevdev pango cairo libinput
    wlroots wayland-protocols
  ] ++ lib.optional gdkPixbufSupport gdk_pixbuf;

  enableParallelBuilding = true;

  mesonFlags =
    [ "-Ddefault-wallpaper=false" "-Dtray=enabled" "-Dman-pages=enabled" ]
    ++ lib.optional gdkPixbufSupport "-Dgdk-pixbuf=enabled"
    ++ lib.optional xwaylandSupport "-Dxwayland=enabled";

  postInstall = ''
    wrapProgram $out/bin/sway --prefix PATH : "${swaybg}/bin"
  '';

  postPatch = ''
    sed -i "s/version: '1.0'/version: '${version}'/" meson.build
  '';

  meta = with lib; {
    description = "i3-compatible tiling Wayland compositor";
    homepage    = https://swaywm.org;
    license     = licenses.mit;
    platforms   = platforms.linux;
    maintainers = with maintainers; [ primeos synthetica ];
  };
}