about summary refs log tree commit diff
path: root/pkgs/by-name/lx
diff options
context:
space:
mode:
author7c6f434c <7c6f434c@mail.ru>2024-04-28 13:43:03 +0000
committerGitHub <noreply@github.com>2024-04-28 13:43:03 +0000
commit242b7421157ff44e58656c79c00aadf164150eae (patch)
tree504e6d5831b5ef5542aebe1b660660e01ec60112 /pkgs/by-name/lx
parent23324e5598bf8c66f58aebf5056964daba503f36 (diff)
parente5c0863e212e7f08a1a8af39c3e1fe5ec541bd55 (diff)
Merge pull request #306002 from oo-infty/init-lx-music-desktop
lx-music-desktop: init at 2.7.0
Diffstat (limited to 'pkgs/by-name/lx')
-rw-r--r--pkgs/by-name/lx/lx-music-desktop/package.nix88
1 files changed, 88 insertions, 0 deletions
diff --git a/pkgs/by-name/lx/lx-music-desktop/package.nix b/pkgs/by-name/lx/lx-music-desktop/package.nix
new file mode 100644
index 0000000000000..0886f7282b77b
--- /dev/null
+++ b/pkgs/by-name/lx/lx-music-desktop/package.nix
@@ -0,0 +1,88 @@
+{ lib
+, stdenv
+, fetchurl
+, makeWrapper
+
+, dpkg
+, libGL
+, systemd
+, electron_28
+
+, commandLineArgs ? ""
+}:
+
+let
+  pname = "lx-music-desktop";
+  version = "2.7.0";
+
+  buildUrl = version: arch: "https://github.com/lyswhut/lx-music-desktop/releases/download/v${version}/lx-music-desktop_${version}_${arch}.deb";
+
+  srcs = {
+    x86_64-linux = fetchurl {
+      url = buildUrl version "amd64";
+      hash = "sha256-+mCAFfiJwa+RQ/9vnSPDrC1LoLIoZyFUEJAF6sXdqRM=";
+    };
+
+    aarch64-linux = fetchurl {
+      url = buildUrl version "arm64";
+      hash = "sha256-fDlgHJqoZLGnUuZeZGdocYLbsE02QBrWPKS31fbGThk=";
+    };
+
+    armv7l-linux = fetchurl {
+      url = buildUrl version "armv7l";
+      hash = "sha256-X6EXsBvTbPGXCJ+ektMCMGDG2zqGKBvWT/TwjGFL3ug=";
+    };
+  };
+
+  host = stdenv.hostPlatform.system;
+  src = srcs.${host} or (throw "Unsupported system: ${host}");
+
+  runtimeLibs = lib.makeLibraryPath [
+    libGL
+    stdenv.cc.cc.lib
+  ];
+in
+stdenv.mkDerivation {
+  inherit pname version src;
+
+  nativeBuildInputs = [
+    dpkg
+    makeWrapper
+  ];
+
+  runtimeDependencies = map lib.getLib [
+    systemd
+  ];
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out/bin $out/opt/lx-music-desktop
+    cp -r opt/lx-music-desktop/{resources,locales} $out/opt/lx-music-desktop
+    cp -r usr/share $out/share
+
+    substituteInPlace $out/share/applications/lx-music-desktop.desktop \
+        --replace-fail "/opt/lx-music-desktop/lx-music-desktop" "$out/bin/lx-music-desktop" \
+
+    runHook postInstall
+  '';
+
+  postFixup = ''
+    makeWrapper ${electron_28}/bin/electron $out/bin/lx-music-desktop \
+        --add-flags $out/opt/lx-music-desktop/resources/app.asar \
+        --prefix LD_LIBRARY_PATH : "${runtimeLibs}" \
+        --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
+        --add-flags ${lib.escapeShellArg commandLineArgs} \
+  '';
+
+  meta = with lib; {
+    description = "A music software based on Electron and Vue";
+    homepage = "https://github.com/lyswhut/lx-music-desktop";
+    changelog = "https://github.com/lyswhut/lx-music-desktop/releases/tag/v${version}";
+    license = licenses.asl20;
+    platforms = [ "x86_64-linux" "aarch64-linux" "armv7l-linux" ];
+    sourceProvenance = with sourceTypes; [ binaryNativeCode ];
+    mainProgram = "lx-music-desktop";
+    maintainers = with maintainers; [ oo-infty ];
+  };
+}