1 { lib, stdenv, fetchFromGitHub, fetchpatch, substituteAll, swaybg
2 , meson, ninja, pkg-config, wayland-scanner, scdoc
3 , libGL, wayland, libxkbcommon, pcre2, json_c, libevdev
4 , pango, cairo, libinput, gdk-pixbuf, librsvg
5 , wlroots, wayland-protocols, libdrm
7 # Used by the NixOS module:
9 , enableXWayland ? true, xorg
10 , systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
11 , trayEnabled ? systemdSupport
14 stdenv.mkDerivation (finalAttrs: {
15 pname = "sway-unwrapped";
18 inherit enableXWayland isNixOS systemdSupport trayEnabled;
19 src = fetchFromGitHub {
22 rev = finalAttrs.version;
23 hash = "sha256-PzeU/niUdqI6sf2TCG19G2vNgAZJE5JCyoTwtO9uFTk=";
27 ./load-configuration-from-etc.patch
30 src = ./fix-paths.patch;
34 # libinput-1.27 support:
35 # https://github.com/swaywm/sway/pull/8470
37 name = "libinput-1.27-p1.patch";
38 url = "https://github.com/swaywm/sway/commit/bbadf9b8b10d171a6d5196da7716ea50ee7a6062.patch";
39 hash = "sha256-lA+oL1vqGQOm7K+AthzHYBzmOALrDgxzX/5Dx7naq84=";
42 name = "libinput-1.27-p2.patch";
43 url = "https://github.com/swaywm/sway/commit/e2409aa49611bee1e1b99033461bfab0a7550c48.patch";
44 hash = "sha256-l598qfq+rpKy3/0arQruwd+BsELx85XDjwIDkb/o6og=";
46 ] ++ lib.optionals (!finalAttrs.isNixOS) [
47 # References to /nix/store/... will get GC'ed which causes problems when
48 # copying the default configuration:
49 ./sway-config-no-nix-store-references.patch
50 ] ++ lib.optionals finalAttrs.isNixOS [
51 # Use /run/current-system/sw/share and /etc instead of /nix/store
53 ./sway-config-nixos-paths.patch
62 meson ninja pkg-config wayland-scanner scdoc
66 libGL wayland libxkbcommon pcre2 json_c libevdev
67 pango cairo libinput gdk-pixbuf librsvg
68 wayland-protocols libdrm
69 (wlroots.override { inherit (finalAttrs) enableXWayland; })
70 ] ++ lib.optionals finalAttrs.enableXWayland [
75 inherit (lib.strings) mesonEnable mesonOption;
77 # The "sd-bus-provider" meson option does not include a "none" option,
78 # but it is silently ignored iff "-Dtray=disabled". We use "basu"
79 # (which is not in nixpkgs) instead of "none" to alert us if this
80 # changes: https://github.com/swaywm/sway/issues/6843#issuecomment-1047288761
81 # assert trayEnabled -> systemdSupport && dbusSupport;
83 sd-bus-provider = if systemdSupport then "libsystemd" else "basu";
85 (mesonOption "sd-bus-provider" sd-bus-provider)
86 (mesonEnable "tray" finalAttrs.trayEnabled)
89 passthru.tests.basic = nixosTests.sway;
92 description = "I3-compatible tiling Wayland compositor";
94 Sway is a tiling Wayland compositor and a drop-in replacement for the i3
95 window manager for X11. It works with your existing i3 configuration and
96 supports most of i3's features, plus a few extras.
97 Sway allows you to arrange your application windows logically, rather
98 than spatially. Windows are arranged into a grid by default which
99 maximizes the efficiency of your screen and can be quickly manipulated
100 using only the keyboard.
102 homepage = "https://swaywm.org";
103 changelog = "https://github.com/swaywm/sway/releases/tag/${finalAttrs.version}";
104 license = lib.licenses.mit;
105 platforms = lib.platforms.linux;
106 maintainers = with lib.maintainers; [ primeos synthetica ];
107 mainProgram = "sway";