Skyler Grey | 889835e | 2024-05-26 21:23:33 +0000 | [diff] [blame^] | 1 | { inputs, system, lib, pkg-config, rustPlatform, libclang, xcb-util-cursor, xorg, musl, makeWrapper }: let |
| 2 | src = inputs.xwayland-satellite; |
| 3 | libraries = [ |
| 4 | xcb-util-cursor |
| 5 | xorg.libxcb |
| 6 | musl |
| 7 | ]; |
| 8 | includeArgs = map (library: ''-I"${library.dev}/include"'') libraries; |
| 9 | libraryArgs = map (library: ''-L"${library}/lib"'') libraries; |
| 10 | extraClangArgs = builtins.concatStringsSep " " (includeArgs ++ libraryArgs); |
| 11 | 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 |
| 12 | in rustPlatform.buildRustPackage { |
| 13 | pname = "xwayland-satellite"; |
| 14 | version = "unstable-${src.lastModifiedDate}"; |
| 15 | |
| 16 | inherit src; |
| 17 | |
| 18 | cargoLock.lockFile = "${src}/Cargo.lock"; |
| 19 | |
| 20 | preBuild = '' |
| 21 | export LIBCLANG_PATH="${libclang.lib}/lib" |
| 22 | export BINDGEN_EXTRA_CLANG_ARGS='${extraClangArgs}' |
| 23 | export LIBRARY_PATH="${lib.makeLibraryPath libraries}" |
| 24 | ''; |
| 25 | |
| 26 | doCheck = false; # xwayland-satellite fails checks due to not being wrapped at this point... |
| 27 | |
| 28 | nativeBuildInputs = libraries ++ [ |
| 29 | libclang.lib |
| 30 | pkg-config |
| 31 | makeWrapper |
| 32 | ]; |
| 33 | |
| 34 | postInstall = '' |
| 35 | wrapProgram $out/bin/xwayland-satellite --suffix PATH : ${lib.makeBinPath [ xwayland ]} |
| 36 | ''; |
| 37 | |
| 38 | buildInputs = [ |
| 39 | xwayland |
| 40 | ]; |
| 41 | |
| 42 | meta = { |
| 43 | description = "Allow rootless xwayland integration for wayland compositors"; |
| 44 | homepage = "https://github.com/Supreeeme/xwayland-satellite"; |
| 45 | license = lib.licenses.mpl20; |
| 46 | maintainers = [ lib.maintainers.minion3665 ]; |
| 47 | }; |
| 48 | } |