From a9544429263d81a3a45270559bb84c568cd5aa9b Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Thu, 4 Jan 2024 11:10:21 +0100 Subject: [PATCH] dayon: make deterministic and clean up Changes: - use `finalAttrs` instead of `rec` - use `canonicalize-jars-hook` (related issue: https://github.com/NixOS/nixpkgs/issues/278518) - patch `.desktop` files to find icons - add `meta.mainProgram` --- .../networking/remote/dayon/default.nix | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/pkgs/applications/networking/remote/dayon/default.nix b/pkgs/applications/networking/remote/dayon/default.nix index 843322df55f0..8986eddb5562 100644 --- a/pkgs/applications/networking/remote/dayon/default.nix +++ b/pkgs/applications/networking/remote/dayon/default.nix @@ -6,16 +6,17 @@ , jre , makeWrapper , copyDesktopItems +, canonicalize-jars-hook }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "dayon"; version = "13.0.0"; src = fetchFromGitHub { owner = "RetGal"; repo = "dayon"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; hash = "sha256-2Fo+LQvsrDvqEudZxzQBtJHGxrRYUyNyhrPV1xS49pQ="; }; @@ -24,6 +25,7 @@ stdenv.mkDerivation rec { jdk makeWrapper copyDesktopItems + canonicalize-jars-hook ]; buildPhase = '' @@ -32,15 +34,10 @@ stdenv.mkDerivation rec { runHook postBuild ''; - desktopItems = [ - "resources/deb/dayon_assisted.desktop" - "resources/deb/dayon_assistant.desktop" - ]; - installPhase = '' runHook preInstall + install -Dm644 build/dayon.jar $out/share/dayon/dayon.jar - mkdir -p $out/bin # jre is in PATH because dayon needs keytool to generate certificates makeWrapper ${jre}/bin/java $out/bin/dayon \ --prefix PATH : "${lib.makeBinPath [ jre ]}" \ @@ -52,14 +49,26 @@ stdenv.mkDerivation rec { --prefix PATH : "${lib.makeBinPath [ jre ]}" \ --add-flags "-cp $out/share/dayon/dayon.jar mpo.dayon.assistant.AssistantRunner" install -Dm644 resources/dayon.png $out/share/icons/hicolor/128x128/apps/dayon.png + runHook postInstall ''; + desktopItems = [ + "resources/deb/dayon_assisted.desktop" + "resources/deb/dayon_assistant.desktop" + ]; + + postFixup = '' + substituteInPlace $out/share/applications/*.desktop \ + --replace "/usr/bin/dayon/dayon.png" "dayon" + ''; + meta = with lib; { - homepage = "https://retgal.github.io/Dayon/index.html"; description = "An easy to use, cross-platform remote desktop assistance solution"; + homepage = "https://retgal.github.io/Dayon/index.html"; license = licenses.gpl3Plus; # https://github.com/RetGal/Dayon/issues/59 - platforms = platforms.all; + mainProgram = "dayon"; maintainers = with maintainers; [ fgaz ]; + platforms = platforms.all; }; -} +})