diff --git a/pkgs/applications/audio/feishin/darwin.nix b/pkgs/applications/audio/feishin/darwin.nix deleted file mode 100644 index 5da2fa6ee0256..0000000000000 --- a/pkgs/applications/audio/feishin/darwin.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ stdenv -, lib -, meta -, fetchurl -, unzip -, mpv -, electron_24 -, makeDesktopItem -, makeWrapper -, pname -, appname -, version -}: - -stdenv.mkDerivation { - inherit pname version meta; - - src = fetchurl { - url = "https://github.com/jeffvli/feishin/releases/download/v${version}/${appname}-${version}-mac-x64.zip"; - hash = "sha256-sJg3hYOiELm+edw2JTFt6cPFdbDj6mLcLngeqEPaPgs="; - }; - - nativeBuildInputs = [ makeWrapper unzip ]; - - # Installs mpv as a requirement - propagatedBuildInputs = [ mpv ]; - - installPhase = '' - runHook preInstall - mkdir -p $out/{Applications/${appname}.app,bin} - cp -R . $out/Applications/${appname}.app - makeWrapper $out/Applications/${appname}.app/Contents/MacOS/${appname} $out/bin/${pname} - runHook postInstall - ''; - - shellHook = '' - set -x - export LD_LIBRARY_PATH=${mpv}/lib - set +x - ''; -} diff --git a/pkgs/applications/audio/feishin/default.nix b/pkgs/applications/audio/feishin/default.nix index c89d5163c2a6d..1df19f72b6f3f 100644 --- a/pkgs/applications/audio/feishin/default.nix +++ b/pkgs/applications/audio/feishin/default.nix @@ -1,27 +1,67 @@ { lib -, stdenv -, callPackage -, ... -}@args: +, buildNpmPackage +, fetchFromGitHub +, electron_27 +}: let - extraArgs = removeAttrs args [ "callPackage" ]; - + electron = electron_27; +in buildNpmPackage rec { pname = "feishin"; - version = "0.5.1"; - appname = "Feishin"; + version = "0.5.3"; + + src = fetchFromGitHub { + owner = "jeffvli"; + repo = "feishin"; + rev = "refs/tags/v${version}"; + hash = "sha256-yzaWOucz1lPWFlknPc8g74LfX/pFFQ2JRYSgauNGMRQ="; + }; + + npmDepsHash = "sha256-Fa59nwkkMHp9GNY8piAz3usNU4lhTzwonlmowFf5qqY="; + + postPatch = '' + substituteInPlace package.json \ + --replace-fail "electron-builder install-app-deps &&" "" + ''; + + npmFlags = [ "--legacy-peer-deps" ]; + + makeCacheWritable = true; + + env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; + + postBuild = '' + npm exec electron-builder -- \ + --dir \ + -c.electronDist=${electron}/libexec/electron \ + -c.electronVersion=${electron.version} \ + -c.npmRebuild=false + ''; + + installPhase = '' + runHook preInstall + + pushd release/build/*/ + mkdir -p $out/opt/feishin + cp -r locales resources{,.pak} $out/opt/feishin + popd + + makeWrapper ${lib.getExe electron} $out/bin/feishin \ + --add-flags $out/opt/feishin/resources/app.asar \ + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \ + --inherit-argv0 + + runHook postInstall + ''; meta = with lib; { description = "Full-featured Subsonic/Jellyfin compatible desktop music player"; homepage = "https://github.com/jeffvli/feishin"; changelog = "https://github.com/jeffvli/feishin/releases/tag/v${version}"; - sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + sourceProvenance = with sourceTypes; [ fromSource ]; license = licenses.mit; - platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + platforms = platforms.unix; + mainProgram = "feishin"; maintainers = with maintainers; [ onny ]; }; - -in -if stdenv.isDarwin -then callPackage ./darwin.nix (extraArgs // { inherit pname appname version meta; }) -else callPackage ./linux.nix (extraArgs // { inherit pname appname version meta; }) +} diff --git a/pkgs/applications/audio/feishin/linux.nix b/pkgs/applications/audio/feishin/linux.nix deleted file mode 100644 index d503492adfc9e..0000000000000 --- a/pkgs/applications/audio/feishin/linux.nix +++ /dev/null @@ -1,71 +0,0 @@ -{ stdenv -, meta -, lib -, fetchurl -, mpv -, graphicsmagick -, electron_24 -, makeDesktopItem -, makeWrapper -, pname -, appname -, version -}: - -let - icon = fetchurl { - url = - "https://github.com/jeffvli/feishin/raw/development/assets/icons/1024x1024.png"; - sha256 = "sha256-8Qigt1CNMa3SDVK2cdqWJuMSl19yfy6nPQfME4qA48I="; - }; - - desktopItem = makeDesktopItem { - name = "feishin"; - desktopName = "Feishin"; - comment = "Full-featured Subsonic/Jellyfin compatible desktop music player"; - icon = "feishin"; - exec = "feishin %u"; - categories = [ "Audio" "AudioVideo" ]; - mimeTypes = [ "x-scheme-handler/feishin" ]; - }; -in - -stdenv.mkDerivation { - inherit pname version meta; - - src = fetchurl { - url = "https://github.com/jeffvli/feishin/releases/download/v${version}/${appname}-${version}-linux-x64.tar.xz"; - hash = "sha256-uYswGxSXz2YddoFs5F7f+ywqAr7qXqp6WryQ7ENSawQ="; - }; - - - nativeBuildInputs = [ makeWrapper graphicsmagick ]; - - # Installs mpv as a requirement - propagatedBuildInputs = [ mpv ]; - - installPhase = '' - runHook preInstall - - mkdir -p $out/bin - mkdir -p $out/share - cp -r resources $out/share/${pname}/ - cp -r locales $out/share/${pname}/ - - makeWrapper ${electron_24}/bin/electron $out/bin/${pname} \ - --add-flags $out/share/${pname}/app.asar - install -m 444 -D "${desktopItem}/share/applications/"* \ - -t $out/share/applications/ - for size in 16 24 32 48 64 128 256 512; do - mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps - gm convert -resize "$size"x"$size" ${icon} $out/share/icons/hicolor/"$size"x"$size"/apps/${appname}.png - done - runHook postInstall - ''; - - shellHook = '' - set -x - export LD_LIBRARY_PATH=${mpv}/lib - set +x - ''; -}