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
parent c9cc100606
commit 9ad57bd37f
No known key found for this signature in database
6 changed files with 42 additions and 49 deletions

View file

@ -28,7 +28,6 @@
overlays = [ overlays = [
inputs.hyprland-protocols.overlays.default inputs.hyprland-protocols.overlays.default
self.overlays.xdg-desktop-portal-hyprland self.overlays.xdg-desktop-portal-hyprland
self.overlays.hyprland-share-picker
self.overlays.package-overrides self.overlays.package-overrides
]; ];
}); });
@ -36,7 +35,7 @@
overlays = import ./nix/overlays.nix {inherit self inputs lib;}; overlays = import ./nix/overlays.nix {inherit self inputs lib;};
packages = eachSystem (system: { 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; 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' systemd_service_file = 'xdg-desktop-portal-hyprland.service'
user_unit_dir = systemd.get_variable(pkgconfig: 'systemduserunitdir', user_unit_dir = systemd.get_variable(pkgconfig: 'systemduserunitdir',
pkgconfig_define: ['prefix', get_option('prefix')]) pkgconfig_define: ['prefix', get_option('prefix')])
conf_data.set('systemd_service', 'SystemdService=' + systemd_service_file)
configure_file( configure_file(
configuration: conf_data, configuration: conf_data,
@ -67,3 +66,4 @@ inc = include_directories('.', 'protocols')
subdir('protocols') subdir('protocols')
subdir('src') subdir('src')
subdir('hyprland-share-picker')

View file

@ -5,7 +5,6 @@
meson, meson,
ninja, ninja,
pkg-config, pkg-config,
hyprland-share-picker,
libdrm, libdrm,
mesa, mesa,
pipewire, pipewire,
@ -13,7 +12,11 @@
systemd, systemd,
wayland-protocols, wayland-protocols,
wayland-scanner, wayland-scanner,
grim, qtbase,
qttools,
qtwayland,
wrapQtAppsHook,
hyprland,
slurp, slurp,
hyprland-protocols, hyprland-protocols,
wayland, wayland,
@ -31,6 +34,7 @@ stdenv.mkDerivation {
pkg-config pkg-config
wayland-scanner wayland-scanner
makeWrapper makeWrapper
wrapQtAppsHook
]; ];
buildInputs = [ buildInputs = [
@ -38,14 +42,24 @@ stdenv.mkDerivation {
libdrm libdrm
mesa mesa
pipewire pipewire
qtbase
qttools
qtwayland
sdbus-cpp sdbus-cpp
systemd systemd
wayland wayland
wayland-protocols wayland-protocols
]; ];
dontWrapQtApps = true;
postInstall = '' 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; { 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 { in {
default = mkJoinedOverlays (with self.overlays; [ default = mkJoinedOverlays (with self.overlays; [
xdg-desktop-portal-hyprland xdg-desktop-portal-hyprland
hyprland-share-picker
package-overrides package-overrides
]); ]);
xdg-desktop-portal-hyprland = final: prev: { xdg-desktop-portal-hyprland = final: prev: {
xdg-desktop-portal-hyprland = final.callPackage ./default.nix { xdg-desktop-portal-hyprland = final.callPackage ./default.nix {
stdenv = prev.gcc13Stdenv; stdenv = prev.gcc13Stdenv;
inherit (final) hyprland-protocols hyprland-share-picker; inherit (final) hyprland-protocols;
inherit version; inherit (final.qt6) qtbase qttools wrapQtAppsHook qtwayland;
};
};
hyprland-share-picker = final: prev: {
hyprland-share-picker = final.callPackage ./hyprland-share-picker.nix {
inherit (final.qt6) qtbase wrapQtAppsHook qtwayland;
inherit version; inherit version;
}; };
}; };