2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, substituteAll, swaybg
|
2022-01-26 04:04:25 +00:00
|
|
|
, meson, ninja, pkg-config, wayland-scanner, scdoc
|
2022-03-10 19:12:11 +00:00
|
|
|
, wayland, libxkbcommon, pcre, json_c, libevdev
|
2020-05-15 21:57:56 +00:00
|
|
|
, pango, cairo, libinput, libcap, pam, gdk-pixbuf, librsvg
|
2021-04-08 16:26:57 +00:00
|
|
|
, wlroots, wayland-protocols, libdrm
|
2021-05-20 23:08:51 +00:00
|
|
|
, nixosTests
|
|
|
|
# Used by the NixOS module:
|
|
|
|
, isNixOS ? false
|
2021-10-17 09:34:42 +00:00
|
|
|
|
|
|
|
, enableXWayland ? true
|
2022-03-10 19:12:11 +00:00
|
|
|
, systemdSupport ? stdenv.isLinux
|
|
|
|
, dbusSupport ? true
|
|
|
|
, dbus
|
|
|
|
, trayEnabled ? systemdSupport && dbusSupport
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2022-03-10 19:12:11 +00:00
|
|
|
# The "sd-bus-provider" meson option does not include a "none" option,
|
|
|
|
# but it is silently ignored iff "-Dtray=disabled". We use "basu"
|
|
|
|
# (which is not in nixpkgs) instead of "none" to alert us if this
|
|
|
|
# changes: https://github.com/swaywm/sway/issues/6843#issuecomment-1047288761
|
|
|
|
assert trayEnabled -> systemdSupport && dbusSupport;
|
|
|
|
let sd-bus-provider = if systemdSupport then "libsystemd" else "basu"; in
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "sway-unwrapped";
|
2022-01-25 03:21:06 +00:00
|
|
|
version = "1.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "swaywm";
|
|
|
|
repo = "sway";
|
|
|
|
rev = version;
|
2022-01-25 03:21:06 +00:00
|
|
|
sha256 = "0ss3l258blyf2d0lwd7pi7ga1fxfj8pxhag058k7cmjhs3y30y5l";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
./load-configuration-from-etc.patch
|
2021-02-05 17:12:51 +00:00
|
|
|
|
|
|
|
(substituteAll {
|
|
|
|
src = ./fix-paths.patch;
|
|
|
|
inherit swaybg;
|
|
|
|
})
|
2021-12-06 16:07:01 +00:00
|
|
|
] ++ lib.optionals (!isNixOS) [
|
|
|
|
# References to /nix/store/... will get GC'ed which causes problems when
|
|
|
|
# copying the default configuration:
|
|
|
|
./sway-config-no-nix-store-references.patch
|
|
|
|
] ++ lib.optionals isNixOS [
|
|
|
|
# Use /run/current-system/sw/share and /etc instead of /nix/store
|
|
|
|
# references:
|
|
|
|
./sway-config-nixos-paths.patch
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
strictDeps = true;
|
2021-12-24 04:21:11 +00:00
|
|
|
depsBuildBuild = [
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = [
|
2022-01-26 04:04:25 +00:00
|
|
|
meson ninja pkg-config wayland-scanner scdoc
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2022-03-10 19:12:11 +00:00
|
|
|
wayland libxkbcommon pcre json_c libevdev
|
2020-05-15 21:57:56 +00:00
|
|
|
pango cairo libinput libcap pam gdk-pixbuf librsvg
|
2021-10-17 09:34:42 +00:00
|
|
|
wayland-protocols libdrm
|
|
|
|
(wlroots.override { inherit enableXWayland; })
|
2022-03-10 19:12:11 +00:00
|
|
|
] ++ lib.optionals dbusSupport [
|
|
|
|
dbus
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2022-03-10 19:12:11 +00:00
|
|
|
mesonFlags =
|
|
|
|
[ "-Dsd-bus-provider=${sd-bus-provider}" ]
|
2021-10-17 09:34:42 +00:00
|
|
|
++ lib.optional (!enableXWayland) "-Dxwayland=disabled"
|
2022-03-10 19:12:11 +00:00
|
|
|
++ lib.optional (!trayEnabled) "-Dtray=disabled"
|
2021-10-17 09:34:42 +00:00
|
|
|
;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
passthru.tests.basic = nixosTests.sway;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-07-18 16:06:22 +00:00
|
|
|
description = "An i3-compatible tiling Wayland compositor";
|
|
|
|
longDescription = ''
|
|
|
|
Sway is a tiling Wayland compositor and a drop-in replacement for the i3
|
|
|
|
window manager for X11. It works with your existing i3 configuration and
|
|
|
|
supports most of i3's features, plus a few extras.
|
|
|
|
Sway allows you to arrange your application windows logically, rather
|
|
|
|
than spatially. Windows are arranged into a grid by default which
|
|
|
|
maximizes the efficiency of your screen and can be quickly manipulated
|
|
|
|
using only the keyboard.
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://swaywm.org";
|
2020-07-18 16:06:22 +00:00
|
|
|
changelog = "https://github.com/swaywm/sway/releases/tag/${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.linux;
|
2022-06-26 10:26:21 +00:00
|
|
|
maintainers = with maintainers; [ primeos synthetica ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|