2023-04-29 16:46:19 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fetchpatch, substituteAll, swaybg
|
2022-01-26 04:04:25 +00:00
|
|
|
, meson, ninja, pkg-config, wayland-scanner, scdoc
|
2022-12-28 21:21:41 +00:00
|
|
|
, wayland, libxkbcommon, pcre2, json_c, libevdev
|
2023-07-15 17:15:38 +00:00
|
|
|
, pango, cairo, libinput, gdk-pixbuf, librsvg
|
|
|
|
, wlroots, wayland-protocols, libdrm
|
2021-05-20 23:08:51 +00:00
|
|
|
, nixosTests
|
|
|
|
# Used by the NixOS module:
|
|
|
|
, isNixOS ? false
|
2022-12-28 21:21:41 +00:00
|
|
|
, enableXWayland ? true, xorg
|
2023-02-02 18:25:31 +00:00
|
|
|
, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
|
2023-07-15 17:15:38 +00:00
|
|
|
, trayEnabled ? systemdSupport
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "sway-unwrapped";
|
2023-02-16 17:41:37 +00:00
|
|
|
version = "1.8.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
inherit enableXWayland isNixOS systemdSupport trayEnabled;
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "swaywm";
|
|
|
|
repo = "sway";
|
2023-07-15 17:15:38 +00:00
|
|
|
rev = finalAttrs.version;
|
2023-02-16 17:41:37 +00:00
|
|
|
hash = "sha256-WxnT+le9vneQLFPz2KoBduOI+zfZPhn1fKlaqbPL6/g=";
|
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;
|
|
|
|
})
|
2023-04-29 16:46:19 +00:00
|
|
|
|
|
|
|
(fetchpatch {
|
|
|
|
name = "LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM.patch";
|
|
|
|
url = "https://github.com/swaywm/sway/commit/dee032d0a0ecd958c902b88302dc59703d703c7f.diff";
|
|
|
|
hash = "sha256-dx+7MpEiAkxTBnJcsT3/1BO8rYRfNLecXmpAvhqGMD0=";
|
|
|
|
})
|
2023-07-15 17:15:38 +00:00
|
|
|
] ++ lib.optionals (!finalAttrs.isNixOS) [
|
2021-12-06 16:07:01 +00:00
|
|
|
# References to /nix/store/... will get GC'ed which causes problems when
|
|
|
|
# copying the default configuration:
|
|
|
|
./sway-config-no-nix-store-references.patch
|
2023-07-15 17:15:38 +00:00
|
|
|
] ++ lib.optionals finalAttrs.isNixOS [
|
2021-12-06 16:07:01 +00:00
|
|
|
# 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-12-28 21:21:41 +00:00
|
|
|
wayland libxkbcommon pcre2 json_c libevdev
|
2023-07-15 17:15:38 +00:00
|
|
|
pango cairo libinput gdk-pixbuf librsvg
|
2021-10-17 09:34:42 +00:00
|
|
|
wayland-protocols libdrm
|
2023-07-15 17:15:38 +00:00
|
|
|
(wlroots.override { inherit (finalAttrs) enableXWayland; })
|
|
|
|
] ++ lib.optionals finalAttrs.enableXWayland [
|
2022-12-28 21:21:41 +00:00
|
|
|
xorg.xcbutilwm
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
mesonFlags = let
|
|
|
|
# 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;
|
|
|
|
|
|
|
|
sd-bus-provider = if systemdSupport then "libsystemd" else "basu";
|
|
|
|
in
|
2022-03-10 19:12:11 +00:00
|
|
|
[ "-Dsd-bus-provider=${sd-bus-provider}" ]
|
2023-07-15 17:15:38 +00:00
|
|
|
++ lib.optional (!finalAttrs.enableXWayland) "-Dxwayland=disabled"
|
|
|
|
++ lib.optional (!finalAttrs.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
|
|
|
};
|
2023-07-15 17:15:38 +00:00
|
|
|
})
|