Merge pull request #237044 from teto/config-sway-via-attributes

sway-unwrapped: rename wlroots_0_16 argument to wlroots
This commit is contained in:
Matthieu Coudron 2023-06-25 13:21:16 +02:00 committed by GitHub
commit a979913d08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 26 deletions

View file

@ -2,7 +2,7 @@
, meson, ninja, pkg-config, wayland-scanner, scdoc
, wayland, libxkbcommon, pcre2, json_c, libevdev
, pango, cairo, libinput, gdk-pixbuf, librsvg
, wlroots_0_16, wayland-protocols, libdrm
, wlroots, wayland-protocols, libdrm
, nixosTests
# Used by the NixOS module:
, isNixOS ? false
@ -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_0_16.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 ];
};
}
})

View file

@ -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

View file

@ -28,15 +28,17 @@
let
generic = { version, hash, extraBuildInputs ? [ ], extraNativeBuildInputs ? [ ], extraPatch ? "" }:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "wlroots";
inherit version;
inherit enableXWayland;
src = fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "wlroots";
repo = "wlroots";
rev = version;
rev = finalAttrs.version;
inherit hash;
};
@ -70,11 +72,11 @@ let
xorg.xcbutilrenderutil
xorg.xcbutilwm
]
++ lib.optional enableXWayland xwayland
++ lib.optional finalAttrs.enableXWayland xwayland
++ extraBuildInputs;
mesonFlags =
lib.optional (!enableXWayland) "-Dxwayland=disabled"
lib.optional (!finalAttrs.enableXWayland) "-Dxwayland=disabled"
;
postFixup = ''
@ -98,13 +100,13 @@ let
Pluggable, composable, unopinionated modules for building a Wayland
compositor; or about 50,000 lines of code you were going to write anyway.
'';
inherit (src.meta) homepage;
inherit (finalAttrs.src.meta) homepage;
changelog = "https://gitlab.freedesktop.org/wlroots/wlroots/-/tags/${version}";
license = licenses.mit;
platforms = platforms.linux;
maintainers = with maintainers; [ primeos synthetica ];
};
};
});
in
rec {

View file

@ -31753,7 +31753,9 @@ with pkgs;
wlroots_0_16
wlroots;
sway-unwrapped = callPackage ../applications/window-managers/sway { };
sway-unwrapped = callPackage ../applications/window-managers/sway {
wlroots = wlroots_0_16;
};
sway = callPackage ../applications/window-managers/sway/wrapper.nix { };
swaybg = callPackage ../applications/window-managers/sway/bg.nix { };
swayidle = callPackage ../applications/window-managers/sway/idle.nix { };