ripasso-cursive: cosmetic changes (#361736)
[NixPkgs.git] / pkgs / by-name / lx / lx-music-desktop / package.nix
blob956e7bc8125f4894a732156590ee594ba7ac78b0
1 { lib
2 , stdenv
3 , fetchurl
4 , makeWrapper
6 , dpkg
7 , libGL
8 , systemd
9 , electron_30
11 , commandLineArgs ? ""
14 let
15   pname = "lx-music-desktop";
16   version = "2.9.0";
18   buildUrl = version: arch: "https://github.com/lyswhut/lx-music-desktop/releases/download/v${version}/lx-music-desktop_${version}_${arch}.deb";
20   srcs = {
21     x86_64-linux = fetchurl {
22       url = buildUrl version "amd64";
23       hash = "sha256-krjC3vAwTMzlWJJIuJmYzFtN/Z/IINnzooUtlONeUM0=";
24     };
26     aarch64-linux = fetchurl {
27       url = buildUrl version "arm64";
28       hash = "sha256-734hTi/vgSrLAks+CV1vxrrZfSShnpExlO0JWUc4oUE=";
29     };
31     armv7l-linux = fetchurl {
32       url = buildUrl version "armv7l";
33       hash = "sha256-e4Elipw7MzO+3XmmGlZfLDFgSph0by5Xy6FtYCie/38=";
34     };
35   };
37   host = stdenv.hostPlatform.system;
38   src = srcs.${host} or (throw "Unsupported system: ${host}");
40   runtimeLibs = lib.makeLibraryPath [
41     libGL
42     stdenv.cc.cc
43   ];
45 stdenv.mkDerivation {
46   inherit pname version src;
48   nativeBuildInputs = [
49     dpkg
50     makeWrapper
51   ];
53   runtimeDependencies = map lib.getLib [
54     systemd
55   ];
57   installPhase = ''
58     runHook preInstall
60     mkdir -p $out/bin $out/opt/lx-music-desktop
61     cp -r opt/lx-music-desktop/{resources,locales} $out/opt/lx-music-desktop
62     cp -r usr/share $out/share
64     substituteInPlace $out/share/applications/lx-music-desktop.desktop \
65         --replace-fail "/opt/lx-music-desktop/lx-music-desktop" "$out/bin/lx-music-desktop" \
67     runHook postInstall
68   '';
70   postFixup = ''
71     makeWrapper ${electron_30}/bin/electron $out/bin/lx-music-desktop \
72         --add-flags $out/opt/lx-music-desktop/resources/app.asar \
73         --prefix LD_LIBRARY_PATH : "${runtimeLibs}" \
74         --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \
75         --add-flags ${lib.escapeShellArg commandLineArgs} \
76   '';
78   meta = with lib; {
79     description = "Music software based on Electron and Vue";
80     homepage = "https://github.com/lyswhut/lx-music-desktop";
81     changelog = "https://github.com/lyswhut/lx-music-desktop/releases/tag/v${version}";
82     license = licenses.asl20;
83     platforms = [ "x86_64-linux" "aarch64-linux" "armv7l-linux" ];
84     sourceProvenance = with sourceTypes; [ binaryNativeCode ];
85     mainProgram = "lx-music-desktop";
86     maintainers = with maintainers; [ oosquare ];
87   };