aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/sdrconnect/default.nix
blob: 98fde83fc2953d5f4563d9faf8f6eeaf0df47b1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{ fetchurl, lib, pkgs, stdenv }:
let
  pname = "sdrconnect";
in
stdenv.mkDerivation {
  inherit pname;
  version = "1.0.2";

  src = fetchurl {
    url = "https://www.sdrplay.com/software/SDRconnect_linux-x64_362ce77dc.run";
    sha256 = "c7231497a1f603035bd184f8500b6e1e7186522f77618afb6422da18d288e6e6";
  };

  sourceRoot = ".";
  unpackCmd = "bash $src --quiet --noexec --target .";

  buildInputs = with pkgs; [
    alsa-lib
    fontconfig.lib
    icu
    libusb1
    remarkable2-toolchain
    stdenv.cc.cc.lib
    util-linux.lib
    xorg.libICE
    xorg.libSM
    xorg.libX11
  ];

  installPhase = ''
    runHook preInstall
    mkdir -p $out/{bin,lib} $out/share/{doc,icons}
    patchelf --set-interpreter ${pkgs.stdenv.cc.libc}/lib/ld-linux-x86-64.so.2 SDRconnect
    patchelf --set-rpath \$ORIGIN/../lib:${pkgs.alsa-lib}/lib:${pkgs.fontconfig.lib}/lib:${pkgs.icu}/lib:${pkgs.libusb1}/lib:${pkgs.remarkable2-toolchain}/lib:${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.util-linux.lib}/lib:${pkgs.xorg.libICE}/lib:${pkgs.xorg.libSM}/lib:${pkgs.xorg.libX11}/lib SDRconnect
    patchelf --add-needed libSkiaSharp.so --add-needed libasound.so.2 --add-needed libfontconfig.so.1 --add-needed libstdc++.so.6 --add-needed libusb-1.0.so.0 --add-needed libuuid.so.1 --add-needed swig_bindings.so SDRconnect
    mv SDRconnect $out/bin
    mv libHarfBuzzSharp.so libSkiaSharp.so swig_bindings.so $out/lib
    mv sdrconnect.ico $out/share/icons
    mv sdrplay_license.txt $out/share/doc
    rm install.sh
    runHook postInstall
  '';

  dontFixup = true;

  meta = with lib; {
    description = "sdrconnect";
    homepage = "https://www.sdrplay.com/sdrconnect/";
    sourceProvenance = with sourceTypes; [ binaryNativeCode ];
    license = licenses.unfree;
    platforms = [ "x86_64-linux" ];
  };
}