hyprland-share-picker: build with meson

Nix: combine xdph and the picker into one package
This commit is contained in:
Mihai Fufezan 2023-09-09 21:55:23 +03:00 committed by Vaxry
parent 0d2d2b20d4
commit 5c1905f549
6 changed files with 42 additions and 49 deletions

View File

@ -28,7 +28,6 @@
overlays = [
inputs.hyprland-protocols.overlays.default
self.overlays.xdg-desktop-portal-hyprland
self.overlays.hyprland-share-picker
self.overlays.package-overrides
];
});
@ -36,7 +35,7 @@
overlays = import ./nix/overlays.nix {inherit self inputs lib;};
packages = eachSystem (system: {
inherit (pkgsFor.${system}) xdg-desktop-portal-hyprland hyprland-share-picker;
inherit (pkgsFor.${system}) xdg-desktop-portal-hyprland;
default = self.packages.${system}.xdg-desktop-portal-hyprland;
});

View File

@ -0,0 +1,21 @@
# select either qt6 or qt5
qtdep = dependency('qt6', 'qt5', modules: ['Widgets'])
qtver = qtdep.version()
qt = import('qt' + qtver[0])
ui_files = qt.compile_ui(sources: 'mainpicker.ui')
moc = qt.compile_moc(headers: 'mainpicker.h')
sources = files([
'main.cpp',
'mainpicker.cpp',
'mainpicker.h',
])
executable('hyprland-share-picker',
sources,
ui_files,
moc,
dependencies: qtdep,
install: true
)

View File

@ -41,7 +41,6 @@ if systemd.found()
systemd_service_file = 'xdg-desktop-portal-hyprland.service'
user_unit_dir = systemd.get_variable(pkgconfig: 'systemduserunitdir',
pkgconfig_define: ['prefix', get_option('prefix')])
conf_data.set('systemd_service', 'SystemdService=' + systemd_service_file)
configure_file(
configuration: conf_data,
@ -67,3 +66,4 @@ inc = include_directories('.', 'protocols')
subdir('protocols')
subdir('src')
subdir('hyprland-share-picker')

View File

@ -5,7 +5,6 @@
meson,
ninja,
pkg-config,
hyprland-share-picker,
libdrm,
mesa,
pipewire,
@ -13,7 +12,11 @@
systemd,
wayland-protocols,
wayland-scanner,
grim,
qtbase,
qttools,
qtwayland,
wrapQtAppsHook,
hyprland,
slurp,
hyprland-protocols,
wayland,
@ -31,6 +34,7 @@ stdenv.mkDerivation {
pkg-config
wayland-scanner
makeWrapper
wrapQtAppsHook
];
buildInputs = [
@ -38,14 +42,24 @@ stdenv.mkDerivation {
libdrm
mesa
pipewire
qtbase
qttools
qtwayland
sdbus-cpp
systemd
wayland
wayland-protocols
];
dontWrapQtApps = true;
postInstall = ''
wrapProgram $out/libexec/xdg-desktop-portal-hyprland --prefix PATH ":" ${lib.makeBinPath [hyprland-share-picker grim slurp]}
wrapProgramShell $out/bin/hyprland-share-picker \
"''${qtWrapperArgs[@]}" \
--prefix PATH ":" ${lib.makeBinPath [slurp hyprland]}
wrapProgramShell $out/libexec/xdg-desktop-portal-hyprland \
--prefix PATH ":" ${lib.makeBinPath [(placeholder "out")]}
'';
meta = with lib; {

View File

@ -1,35 +0,0 @@
{
stdenv,
lib,
cmake,
qtbase,
qtwayland,
makeShellWrapper,
wrapQtAppsHook,
hyprland,
slurp,
version ? "git",
}:
stdenv.mkDerivation {
pname = "hyprland-share-picker";
inherit version;
src = ../hyprland-share-picker;
nativeBuildInputs = [
cmake
wrapQtAppsHook
makeShellWrapper
];
buildInputs = [
qtbase
qtwayland
];
dontWrapQtApps = true;
postInstall = ''
wrapProgramShell $out/bin/hyprland-share-picker \
"''${qtWrapperArgs[@]}" \
--prefix PATH ":" ${lib.makeBinPath [slurp hyprland]}
'';
}

View File

@ -18,19 +18,13 @@
in {
default = mkJoinedOverlays (with self.overlays; [
xdg-desktop-portal-hyprland
hyprland-share-picker
package-overrides
]);
xdg-desktop-portal-hyprland = final: prev: {
xdg-desktop-portal-hyprland = final.callPackage ./default.nix {
stdenv = prev.gcc13Stdenv;
inherit (final) hyprland-protocols hyprland-share-picker;
inherit version;
};
};
hyprland-share-picker = final: prev: {
hyprland-share-picker = final.callPackage ./hyprland-share-picker.nix {
inherit (final.qt6) qtbase wrapQtAppsHook qtwayland;
inherit (final) hyprland-protocols;
inherit (final.qt6) qtbase qttools wrapQtAppsHook qtwayland;
inherit version;
};
};