nixos-configuration/modules/portals/xdg-desktop-portal-termfilechooser.nix
2025-03-21 02:00:29 +01:00

74 lines
1.9 KiB
Nix
Executable file

{
lib,
stdenv,
fetchFromGitHub,
unstableGitUpdater,
pkgs,
}:
stdenv.mkDerivation {
name = "xdg-desktop-portal-termfilechooser";
version = "1.0.0";
src = fetchFromGitHub {
repo = "xdg-desktop-portal-termfilechooser";
owner = "GermainZ";
rev = "71dc7ab06751e51de392b9a7af2b50018e40e062";
hash = "sha256-645hoLhQNncqfLKcYCgWLbSrTRUNELh6EAdgUVq3ypM=";
};
dontConfigure = true;
nativeBuildInputs = with pkgs; [
meson
ninja
gcc
pkg-config
scdoc
inih
systemdMinimal
];
buildPhase = ''
runHook preBuild
# mv $src/meson.build $src/meson.build.old
# cat $src/meson.build.old > $src/meson.build
#
mkdir -p /tmp/xdg-desktop-portal-termfilechooser/
cp -r $src/* /tmp/xdg-desktop-portal-termfilechooser
substituteInPlace /tmp/xdg-desktop-portal-termfilechooser/meson.build --replace "'-D_POSIX_C_SOURCE=200809L'," "'-D_POSIX_C_SOURCE=200809L','-O3'"
cd /tmp/xdg-desktop-portal-termfilechooser/
meson build
ninja -C build
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/share/{dbus-1/services,xdg-desktop-portal/portals}
cp /tmp/xdg-desktop-portal-termfilechooser/build/*.service $out/share/dbus-1/services/
cp /tmp/xdg-desktop-portal-termfilechooser/termfilechooser.portal $out/share/xdg-desktop-portal/portals/
mkdir -p $out/libexec
cp /tmp/xdg-desktop-portal-termfilechooser/build/xdg-desktop-portal-termfilechooser $out/libexec
runHook postInstall
'';
meta = with lib; {
homepage = "https://github.com/GermainZ/xdg-desktop-portal-termfilechooser";
description = "xdg-desktop-portal backend for choosing files with your favorite file chooser.";
license = licenses.mit;
maintainers = with maintainers; [SpoodyTheOne];
mainProgram = "xdg-desktop-portal-termfilechooser";
platforms = platforms.linux;
};
}