sway: move enableXWayland to derivation attribute
it's easier to use overrideAttrs than override IMO, and for the home-manager module I would like to be able to configure sway forks the same way as the original sway which is not possible currently see https://github.com/nix-community/home-manager/pull/4039
This commit is contained in:
@@ -11,21 +11,15 @@
|
||||
, trayEnabled ? systemdSupport
|
||||
}:
|
||||
|
||||
# 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;
|
||||
let sd-bus-provider = if systemdSupport then "libsystemd" else "basu"; in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "sway-unwrapped";
|
||||
version = "1.8.1";
|
||||
|
||||
inherit enableXWayland isNixOS systemdSupport trayEnabled;
|
||||
src = fetchFromGitHub {
|
||||
owner = "swaywm";
|
||||
repo = "sway";
|
||||
rev = version;
|
||||
rev = finalAttrs.version;
|
||||
hash = "sha256-WxnT+le9vneQLFPz2KoBduOI+zfZPhn1fKlaqbPL6/g=";
|
||||
};
|
||||
|
||||
@@ -42,11 +36,11 @@ stdenv.mkDerivation rec {
|
||||
url = "https://github.com/swaywm/sway/commit/dee032d0a0ecd958c902b88302dc59703d703c7f.diff";
|
||||
hash = "sha256-dx+7MpEiAkxTBnJcsT3/1BO8rYRfNLecXmpAvhqGMD0=";
|
||||
})
|
||||
] ++ lib.optionals (!isNixOS) [
|
||||
] ++ lib.optionals (!finalAttrs.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 [
|
||||
] ++ lib.optionals finalAttrs.isNixOS [
|
||||
# Use /run/current-system/sw/share and /etc instead of /nix/store
|
||||
# references:
|
||||
./sway-config-nixos-paths.patch
|
||||
@@ -65,15 +59,23 @@ stdenv.mkDerivation rec {
|
||||
wayland libxkbcommon pcre2 json_c libevdev
|
||||
pango cairo libinput gdk-pixbuf librsvg
|
||||
wayland-protocols libdrm
|
||||
(wlroots.override { inherit enableXWayland; })
|
||||
] ++ lib.optionals enableXWayland [
|
||||
(wlroots.override { inherit (finalAttrs) enableXWayland; })
|
||||
] ++ lib.optionals finalAttrs.enableXWayland [
|
||||
xorg.xcbutilwm
|
||||
];
|
||||
|
||||
mesonFlags =
|
||||
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
|
||||
[ "-Dsd-bus-provider=${sd-bus-provider}" ]
|
||||
++ lib.optional (!enableXWayland) "-Dxwayland=disabled"
|
||||
++ lib.optional (!trayEnabled) "-Dtray=disabled"
|
||||
++ lib.optional (!finalAttrs.enableXWayland) "-Dxwayland=disabled"
|
||||
++ lib.optional (!finalAttrs.trayEnabled) "-Dtray=disabled"
|
||||
;
|
||||
|
||||
passthru.tests.basic = nixosTests.sway;
|
||||
@@ -95,4 +97,4 @@ stdenv.mkDerivation rec {
|
||||
platforms = platforms.linux;
|
||||
maintainers = with maintainers; [ primeos synthetica ];
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
@@ -16,7 +16,7 @@ assert extraSessionCommands != "" -> withBaseWrapper;
|
||||
with lib;
|
||||
|
||||
let
|
||||
sway = sway-unwrapped.override { inherit isNixOS enableXWayland; };
|
||||
sway = sway-unwrapped.overrideAttrs (oa: { inherit isNixOS enableXWayland; });
|
||||
baseWrapper = writeShellScriptBin "sway" ''
|
||||
set -o errexit
|
||||
if [ ! "$_SWAY_WRAPPER_ALREADY_EXECUTED" ]; then
|
||||
|
||||
Reference in New Issue
Block a user