feat: add xwayland-satellite
Niri doesn't come with xwayland support, so we provide
xwayland-satellite to have native-like X windows in wayland
Change-Id: I6c1d417e433abda269cfb08b210c55ae688af2b0
diff --git a/flake.lock b/flake.lock
index 25b5442..be1ca4d 100644
--- a/flake.lock
+++ b/flake.lock
@@ -676,6 +676,22 @@
"type": "github"
}
},
+ "nixpkgs-xwayland-23": {
+ "locked": {
+ "lastModified": 1716361217,
+ "narHash": "sha256-mzZDr00WUiUXVm1ujBVv6A0qRd8okaITyUp4ezYRgc4=",
+ "owner": "nixos",
+ "repo": "nixpkgs",
+ "rev": "46397778ef1f73414b03ed553a3368f0e7e33c2f",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nixos",
+ "repo": "nixpkgs",
+ "rev": "46397778ef1f73414b03ed553a3368f0e7e33c2f",
+ "type": "github"
+ }
+ },
"nixpkgs_2": {
"locked": {
"lastModified": 1700612854,
@@ -802,10 +818,12 @@
"nix-index-database": "nix-index-database",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_4",
+ "nixpkgs-xwayland-23": "nixpkgs-xwayland-23",
"nur": "nur",
"snowfall-lib": "snowfall-lib",
"sops-nix": "sops-nix",
- "templates": "templates"
+ "templates": "templates",
+ "xwayland-satellite": "xwayland-satellite"
}
},
"snowfall-lib": {
@@ -954,6 +972,22 @@
"type": "git",
"url": "https://git.clicks.codes/Templates"
}
+ },
+ "xwayland-satellite": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1716523768,
+ "narHash": "sha256-zdQwzUzaTx/+OIo6hHbi2GwhGFAbsogqWVKfy2H3Mro=",
+ "owner": "Supreeeme",
+ "repo": "xwayland-satellite",
+ "rev": "02bee5aea7d4e95abad5c6792f6caab1190a1e68",
+ "type": "github"
+ },
+ "original": {
+ "owner": "Supreeeme",
+ "repo": "xwayland-satellite",
+ "type": "github"
+ }
}
},
"root": "root",
diff --git a/flake.nix b/flake.nix
index 5df0a55..ccc2bcc 100644
--- a/flake.nix
+++ b/flake.nix
@@ -58,6 +58,7 @@
nixos-hardware.url = "github:nixos/nixos-hardware/master";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
+ nixpkgs-xwayland-23.url = "github:nixos/nixpkgs?rev=46397778ef1f73414b03ed553a3368f0e7e33c2f";
nur.url = "github:nix-community/nur";
@@ -71,6 +72,11 @@
templates.url = "git+https://git.clicks.codes/Templates";
emacs-overlay.url = "github:nix-community/emacs-overlay";
+
+ xwayland-satellite = {
+ url = "github:Supreeeme/xwayland-satellite";
+ flake = false;
+ };
};
outputs =
diff --git a/homes/x86_64-linux/minion@greylag/default.nix b/homes/x86_64-linux/minion@greylag/default.nix
index 52a91e6..c46ca09 100644
--- a/homes/x86_64-linux/minion@greylag/default.nix
+++ b/homes/x86_64-linux/minion@greylag/default.nix
@@ -22,6 +22,7 @@
chimera.minion.enable = true;
home.packages = [
pkgs.wl-clipboard
+ pkgs.chimera.xwayland-satellite
];
chimera.waybar = {
diff --git a/packages/xwayland-satellite/default.nix b/packages/xwayland-satellite/default.nix
new file mode 100644
index 0000000..5bfa4fa
--- /dev/null
+++ b/packages/xwayland-satellite/default.nix
@@ -0,0 +1,48 @@
+{ inputs, system, lib, pkg-config, rustPlatform, libclang, xcb-util-cursor, xorg, musl, makeWrapper }: let
+ src = inputs.xwayland-satellite;
+ libraries = [
+ xcb-util-cursor
+ xorg.libxcb
+ musl
+ ];
+ includeArgs = map (library: ''-I"${library.dev}/include"'') libraries;
+ libraryArgs = map (library: ''-L"${library}/lib"'') libraries;
+ extraClangArgs = builtins.concatStringsSep " " (includeArgs ++ libraryArgs);
+ xwayland = inputs.nixpkgs-xwayland-23.legacyPackages.${system}.xwayland; # needed to avoid steam big picture mode failing, see https://github.com/Supreeeme/xwayland-satellite/issues/18
+in rustPlatform.buildRustPackage {
+ pname = "xwayland-satellite";
+ version = "unstable-${src.lastModifiedDate}";
+
+ inherit src;
+
+ cargoLock.lockFile = "${src}/Cargo.lock";
+
+ preBuild = ''
+ export LIBCLANG_PATH="${libclang.lib}/lib"
+ export BINDGEN_EXTRA_CLANG_ARGS='${extraClangArgs}'
+ export LIBRARY_PATH="${lib.makeLibraryPath libraries}"
+ '';
+
+ doCheck = false; # xwayland-satellite fails checks due to not being wrapped at this point...
+
+ nativeBuildInputs = libraries ++ [
+ libclang.lib
+ pkg-config
+ makeWrapper
+ ];
+
+ postInstall = ''
+ wrapProgram $out/bin/xwayland-satellite --suffix PATH : ${lib.makeBinPath [ xwayland ]}
+ '';
+
+ buildInputs = [
+ xwayland
+ ];
+
+ meta = {
+ description = "Allow rootless xwayland integration for wayland compositors";
+ homepage = "https://github.com/Supreeeme/xwayland-satellite";
+ license = lib.licenses.mpl20;
+ maintainers = [ lib.maintainers.minion3665 ];
+ };
+}