NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.16k stars 14.19k forks source link

Synology Chat #179451

Open JalilArfaoui opened 2 years ago

JalilArfaoui commented 2 years ago

Project description Synology Chat client

Downloadable here : https://www.synology.com/fr-fr/support/download/RS818+?version=7.0#utilities

Archlinux calls it synochat

Metadata

shimunn commented 10 months ago

Hi there,

I've managed to create an overlay which is patches synochat however I still cant start the patched binary without steam-run:

{ ... }: final: prev: {
  synochat = with prev;
    stdenv.mkDerivation rec {
      name = "SynologyChat-${version}";
      version = "1.2.2-0222";
      src = stdenv.mkDerivation {
        inherit version;
        name = name + "-deb";
        src = fetchurl {
          url = "https://global.download.synology.com/download/Utility/ChatClient/${version}/Ubuntu/x86_64/Synology%20Chat%20Client-${version}.deb";
          sha256 = "sha256-XS93IC0EktOOp3X/TsFtWocBCu+JDKxGksEr2IMQ/8E=";
        };
        nativeBuildInputs = [ dpkg ];
        sourceRoot = ".";
        unpackCmd = "dpkg-deb -x $src $out";
        __contentAddressed = true;
      };

      dontConfigure = true;
      dontBuild = true;

      binary = ''$out/opt/Synology\ Chat/synochat'';

      nativeBuildInputs = [ makeWrapper patchelf autoPatchelfHook ];

      installPhase = ''
          runHook preInstall
          mkdir -p $out/bin
          cp -R opt usr/share $out/
          substituteInPlace $out/share/applications/synochat.desktop \
        --replace 'Exec="/opt/Synology Chat/synochat"' "Exec=synochat"
          # fix the path in the desktop file
          runHook postInstall
      '';

      postInstall = ''
        makeWrapper ${binary} $out/bin/synochat \
         --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath buildInputs}:$out/opt/Synology\ Chat \
      '';
      buildInputs = [
        stdenv.cc.cc.lib
        alsa-lib
        nss
        libdrm
        mesa
        glib
        nspr
        atk
        cups
        dbus
        gtk3
        pango
        cairo
        gdk-pixbuf
        xorg.libX11
        xorg.libXcomposite
        xorg.libXdamage
        xorg.libXext
        xorg.libXfixes
        xorg.libXrandr
        xorg.libxcb
        expat
        libxkbcommon
        gnome.gvfs
      ];
      meta = with lib; {
        license = licenses.unfree;
        platforms = platforms.linux;
        mainProgram = "synochat";
      };
    };
}

I'd appreciate any hints on how to get rid of steam-run and would be happy to create an PR once I've got this running.