hydrus: add desktop file

The flatpak package for Hydrus Network install a .desktop file.
I updated this file so that the Nix package also generate a .desktop file on install.
This commit is contained in:
Alexis Lapierre 2024-04-25 07:58:53 +02:00
parent e97a23c920
commit 4fbe91c73b
No known key found for this signature in database
GPG Key ID: F413FEC64FA230D2

View File

@ -8,6 +8,8 @@
, python3Packages
, qtbase
, qtcharts
, makeDesktopItem
, copyDesktopItems
}:
python3Packages.buildPythonPackage rec {
@ -25,6 +27,7 @@ python3Packages.buildPythonPackage rec {
nativeBuildInputs = [
wrapQtAppsHook
python3Packages.mkdocs-material
copyDesktopItems
];
buildInputs = [
@ -32,6 +35,20 @@ python3Packages.buildPythonPackage rec {
qtcharts
];
desktopItems = [
(makeDesktopItem {
name = "hydrus-client";
exec = "hydrus-client";
desktopName = "Hydrus Client";
icon = "hydrus-client";
comment = meta.description;
terminal = false;
type = "Application";
categories = [ "FileTools" "Utility" ];
})
];
propagatedBuildInputs = with python3Packages; [
beautifulsoup4
cbor2
@ -104,6 +121,8 @@ python3Packages.buildPythonPackage rec {
outputs = [ "out" "doc" ];
installPhase = ''
runHook preInstall
# Move the hydrus module and related directories
mkdir -p $out/${python3Packages.python.sitePackages}
mv {hydrus,static,db} $out/${python3Packages.python.sitePackages}
@ -118,12 +137,18 @@ python3Packages.buildPythonPackage rec {
mkdir -p $out/bin
install -m0755 hydrus_server.py $out/bin/hydrus-server
install -m0755 hydrus_client.py $out/bin/hydrus-client
# desktop item
mkdir -p "$out/share/icons/hicolor/scalable/apps"
ln -s "$doc/share/doc/hydrus/assets/hydrus-white.svg" "$out/share/icons/hicolor/scalable/apps/hydrus-client.svg"
'' + lib.optionalString enableSwftools ''
mkdir -p $out/${python3Packages.python.sitePackages}/bin
# swfrender seems to have to be called sfwrender_linux
# not sure if it can be loaded through PATH, but this is simpler
# $out/python3Packages.python.sitePackages/bin is correct NOT .../hydrus/bin
ln -s ${swftools}/bin/swfrender $out/${python3Packages.python.sitePackages}/bin/swfrender_linux
'' + ''
runHook postInstall
'';
dontWrapQtApps = true;