1 { lib, stdenv, fetchFromGitHub, 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-/6+iDkQfdLcL/pTJaqNc6QdP4SRVOYLjfOItEu/bZtg=";
27 ./load-configuration-from-etc.patch
30 src = ./fix-paths.patch;
34 ] ++ lib.optionals (!finalAttrs.isNixOS) [
35 # References to /nix/store/... will get GC'ed which causes problems when
36 # copying the default configuration:
37 ./sway-config-no-nix-store-references.patch
38 ] ++ lib.optionals finalAttrs.isNixOS [
39 # Use /run/current-system/sw/share and /etc instead of /nix/store
41 ./sway-config-nixos-paths.patch
50 meson ninja pkg-config wayland-scanner scdoc
54 libGL wayland libxkbcommon pcre2 json_c libevdev
55 pango cairo libinput gdk-pixbuf librsvg
56 wayland-protocols libdrm
57 (wlroots.override { inherit (finalAttrs) enableXWayland; })
58 ] ++ lib.optionals finalAttrs.enableXWayland [
63 inherit (lib.strings) mesonEnable mesonOption;
65 # The "sd-bus-provider" meson option does not include a "none" option,
66 # but it is silently ignored iff "-Dtray=disabled". We use "basu"
67 # (which is not in nixpkgs) instead of "none" to alert us if this
68 # changes: https://github.com/swaywm/sway/issues/6843#issuecomment-1047288761
69 # assert trayEnabled -> systemdSupport && dbusSupport;
71 sd-bus-provider = if systemdSupport then "libsystemd" else "basu";
73 (mesonOption "sd-bus-provider" sd-bus-provider)
74 (mesonEnable "xwayland" finalAttrs.enableXWayland)
75 (mesonEnable "tray" finalAttrs.trayEnabled)
78 passthru.tests.basic = nixosTests.sway;
81 description = "I3-compatible tiling Wayland compositor";
83 Sway is a tiling Wayland compositor and a drop-in replacement for the i3
84 window manager for X11. It works with your existing i3 configuration and
85 supports most of i3's features, plus a few extras.
86 Sway allows you to arrange your application windows logically, rather
87 than spatially. Windows are arranged into a grid by default which
88 maximizes the efficiency of your screen and can be quickly manipulated
89 using only the keyboard.
91 homepage = "https://swaywm.org";
92 changelog = "https://github.com/swaywm/sway/releases/tag/${finalAttrs.version}";
93 license = lib.licenses.mit;
94 platforms = lib.platforms.linux;
95 maintainers = with lib.maintainers; [ primeos synthetica ];