diff --git a/.github/workflows/build.sh b/.github/workflows/build.sh deleted file mode 100755 index 9a8b9ba..0000000 --- a/.github/workflows/build.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -set -e - -if [ -f /etc/os-release ]; then - . /etc/os-release - OS=$NAME -elif [ -f /etc/lsb-release ]; then - . /etc/lsb-release - OS=$DISTRIB_ID -else - OS=$(uname -s) -fi - -case $OS in - "Arch Linux") - echo "Arch Linux" - pacman -Syy --noconfirm - pacman -S --noconfirm git sudo base-devel p7zip nodejs jq asar electron27 libpulse dpkg unzip xdg-utils python - # fix makepkg from non-root - mkdir /home/build - chgrp nobody /home/build - chmod g+ws /home/build - setfacl -m u::rwx,g::rwx /home/build - setfacl -d --set u::rwx,g::rwx,o::- /home/build - chown nobody . - sudo -u nobody makepkg --log - - mkdir dist - mv *.pkg.tar.zst dist - - mv ./src/app/yandex-music.asar dist/yandex-music.asar - mv ./src/app/release_notes.json dist/release_notes.json - - sh ./build_deb.sh -a all - mv deb/*.deb dist - ;; - "Ubuntu") - echo NixOS - export NIXPKGS_ALLOW_UNFREE=1 - nix build --impure - ;; - *) - echo "Operating system is not recognized." - ;; -esac diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2a8bdbb..e286be9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,26 +21,58 @@ jobs: container: image: archlinux:latest steps: + - name: Install packages + run: pacman -Syy --noconfirm && pacman -S --noconfirm git sudo base-devel p7zip nodejs jq asar electron27 libpulse dpkg unzip xdg-utils python rpm-tools - name: Checkout uses: actions/checkout@v4 with: ref: ${{ (inputs.ref || '') }} - - name: Build - run: sh ./.github/workflows/build.sh + - name: Create dist directory + run: mkdir -p dist - - name: Upload Arch artifact + - name: Fix permissions for build + run: mkdir /home/build && chgrp nobody /home/build && chmod g+ws /home/build && setfacl -m u::rwx,g::rwx /home/build && setfacl -d --set u::rwx,g::rwx,o::- /home/build && chown nobody . + + - name: Make Arch package + run: sudo -u nobody makepkg --log && mv *.pkg.tar.zst dist/ + + - name: Build tarball packages + run: bash ./build_tarball.sh -a all && cp tar/* dist/ + + - name: Build Deb packages + run: bash ./build_deb.sh -a all && mv deb/*.deb dist + + - name: Build RPM packages + run: bash ./build_rpm.sh && mv rpm/*.rpm dist + + - name: Retrieve Asar and release notes + run: mv ./src/app/yandex-music.asar dist/yandex-music.asar && mv ./src/app/release_notes.json dist/release_notes.json + + - name: Upload Arch artifacts uses: actions/upload-artifact@v4 with: path: ./dist/*.pkg.tar.zst name: arch-packages + - name: Upload tarball artifacts + uses: actions/upload-artifact@v4 + with: + path: ./dist/*.tar.gz + name: tar-packages + - name: Upload Deb artifact uses: actions/upload-artifact@v4 with: path: ./dist/*.deb name: deb-packages + - name: Upload RPM artifact + uses: actions/upload-artifact@v4 + with: + path: ./dist/*.rpm + name: rpm-packages + - name: Upload Asar artifacts uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/update-build-release.yml b/.github/workflows/update-build-release.yml index 18d0c3f..3049edf 100644 --- a/.github/workflows/update-build-release.yml +++ b/.github/workflows/update-build-release.yml @@ -32,7 +32,7 @@ jobs: run: python utility/generate_packages.py - name: Retrieve version to make commit - run: sh .github/workflows/retrieve_version.sh + run: bash .github/workflows/retrieve_version.sh - name: Commit and push changes uses: EndBug/add-and-commit@v9.1.4 @@ -44,7 +44,7 @@ jobs: author_email: "loraner123@gmail.com" - name: Publish package changes to AUR - if: "${{ github.event.commits[0] }}" + if: "${{ github.event.commits[0] || steps.commit.outputs.commited }}" uses: KSXGitHub/github-actions-deploy-aur@v2.7.0 with: pkgname: "yandex-music" @@ -54,7 +54,7 @@ jobs: commit_username: "cucumber-sp" commit_email: "loraner123@gmail.com" ssh_private_key: "${{ secrets.AUR_SSH_PRIVATE_KEY }}" - commit_message: "${{ github.event.commits[0].message }}" + commit_message: "${{ github.event.commits[0].message || env.release_name }}" ssh_keyscan_types: "rsa,dsa,ecdsa,ed25519" outputs: @@ -86,7 +86,7 @@ jobs: run: | sudo apt-get update sudo apt-get install jq - sh ./.github/workflows/retrieve_version.sh + bash ./.github/workflows/retrieve_version.sh - name: Get Release Notes HTML run: echo "release_html=$(jq -r --arg version "$VERSION" '.["desktop-release-notes." + $version]' ./dist/release_notes.json)" >> $GITHUB_ENV diff --git a/.gitignore b/.gitignore index 1252f14..3c63cb9 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,7 @@ app/ arch/ deb/ + +tar/ + +rpm/ diff --git a/PKGBUILD b/PKGBUILD index d5ff8d7..f7d4d09 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Andrey Onischenko loraner123@gmail.com pkgname=yandex-music -pkgver="5.0.12" +pkgver="5.0.14" pkgrel="1" pkgdesc="Yandex Music - Personal recommendations, selections for any occasion and new music" arch=("any") @@ -10,11 +10,11 @@ license=("custom") depends=("electron27" "libpulse" "xdg-utils") makedepends=("p7zip" "nodejs" "asar" "jq" "python") -source=("https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.12.exe" "git+https://github.com/cucumber-sp/yandex-music-linux") -sha256sums=("4ebeac9620f60e9e2333114cf8c8fb3dc6f2c2c70da58ba56902aa75d65ce4f8" "SKIP") +source=("https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.14.exe" "git+https://github.com/cucumber-sp/yandex-music-linux") +sha256sums=("c10c6c4b5d596f9bf490a231d7c13bbd2627109f71c9c57aa4e2b034e31252f4" "SKIP") build() { - sh "$srcdir/yandex-music-linux/repack.sh" "$srcdir/Yandex_Music_x64_5.0.12.exe" + bash "$srcdir/yandex-music-linux/repack.sh" "$srcdir/Yandex_Music_x64_5.0.14.exe" } package() { diff --git a/README.md b/README.md index 5ede817..94a4674 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ You can obtain the latest version of package from `AUR` using one of the [AUR He For this example I will use [yay](https://github.com/Jguer/yay) -``` +```bash yay -S yandex-music ``` @@ -46,7 +46,7 @@ Download prebuilt binary package from [Releases](https://github.com/cucumber-sp/ Then you can install it with the following command -``` +```bash pacman -U yandex-music--any.pkg.tar.zst ``` @@ -66,7 +66,7 @@ Download prebuilt binary package from [Releases](https://github.com/cucumber-sp/ Then you can install it with the following command -``` +```bash dpkg -i yandex-music__.deb ``` @@ -89,7 +89,7 @@ That's the list of packages you might need to install to be able to manually bui In addition you will need to install [Asar](https://github.com/electron/asar) tool with `npm`. I recommend install it globally with the following command -``` +```bash npm install -g @electron/asar ``` @@ -101,8 +101,8 @@ Last step is to download original client `.exe` file. You can get it yourself or If you only want to get extracted app project with applied patches, you can use the following command: -``` -sh repack.sh -x [-o OUTPUT_DIR default=./app] +```bash +bash repack.sh -x [-o OUTPUT_DIR default=./app] ``` *** @@ -110,8 +110,8 @@ sh repack.sh -x [-o OUTPUT_DIR default=./app] `.asar` is archive file that containes all electron app resources and information, but doesn't hold Electron binaries. If you have `.asar` file you can launch app using `electron .asar`. You can build this archive with the following command: -``` -sh repack.sh [-o OUTPUT_DIR default=./app] +```bash +bash repack.sh [-o OUTPUT_DIR default=./app] ``` *** @@ -120,7 +120,7 @@ sh repack.sh [-o OUTPUT_DIR default=./app] You can build `pacman` package file manually using `PKGBUILD` file from the this repository. Run following commands in folder with `PKGBUILD` file inside to get `.pkg.tar.zst` package: -``` +```bash pacman -S electron libpulse makepkg ``` @@ -131,8 +131,8 @@ makepkg You can build `.deb` binary package using the following command: -``` -sh build_deb.sh [-a default=x64] +```bash +bash build_deb.sh [-a default=x64] ``` *** @@ -146,7 +146,7 @@ The `yandex-music` package has unlicensed license, so you need to have Execute next to build and run yandex music directly from github -``` +```bash nix run github:cucumber-sp/yandex-music-linux ``` @@ -155,11 +155,41 @@ nix run github:cucumber-sp/yandex-music-linux Execute next in this repository to build yandex-music package without using flakes. -``` +```bash nix-build --expr '(import {}).callPackage ./nix {}' ``` ### Install to NixOS -This flake exports `modules` list. Append it to your system modules and add -`yandex-music` package to `environment.systemPackages`. +1. Add input in your flake.nix + + ```nix + inputs = { + yandex-music.url = "github:cucumber-sp/yandex-music-linux"; + }; + ``` + +2. Import module in your `configuration.nix` or `home-manager.nix` + + ```nix + imports = [ + yandex-music.nixosModule + ]; + ``` + +3. Add package `yandex-music` + + For `configuration.nix`: + + ```nix + environment.systemPackages = with pkgs; [ + yandex-music + ]; + ``` + For Home Manager: + + ```nix + home.packages = with pkgs; [ + yandex-music + ]; + ``` diff --git a/build_deb.sh b/build_deb.sh index feec793..644a461 100755 --- a/build_deb.sh +++ b/build_deb.sh @@ -10,12 +10,14 @@ usage() { echo " -h Show this help and exit" } -download_electron_binary(){ +prepare_tarball(){ arch=${1} - echo "Downloading electron ${arch}" - LINK=$(jq -r .electron."${arch}" ./utility/version_info.json) - curl -L -o "${TEMPDIR}/electron-${arch}.zip" "${LINK}" - unzip -q "${TEMPDIR}/electron-${arch}.zip" -d "${TEMPDIR}/electron-${arch}" + echo "Preparing tarball for ${arch}" + if [ ! -f "tar/yandex-music_${version}_${arch}.tar.gz" ]; then + echo "Building tarball for ${arch}" + bash build_tarball.sh -a "${arch}" + fi + cp "tar/yandex-music_${version}_${arch}.tar.gz" "${TEMPDIR}/yandex-music_${version}_${arch}.tar.gz" } build_deb(){ @@ -30,25 +32,8 @@ build_deb(){ sed -i "s/%version%/${version}/g" "${pkgdir}/DEBIAN/control" sed -i "s/%arch%/${pkgarch}/g" "${pkgdir}/DEBIAN/control" - mkdir -p "${pkgdir}/usr/lib/yandex-music" - mkdir -p "${pkgdir}/usr/share/applications" - mkdir -p "${pkgdir}/usr/share/licenses/yandex-music" - mkdir -p "${pkgdir}/usr/share/pixmaps" - mkdir -p "${pkgdir}/usr/bin" - - install -Dm644 "${TEMPDIR}/app/yandex-music.asar" "${pkgdir}/usr/lib/yandex-music/yandex-music.asar" - - install -Dm644 "${TEMPDIR}/app/favicon.png" "${pkgdir}/usr/share/pixmaps/yandex-music.png" - install -Dm644 "${TEMPDIR}/app/favicon.png" "${pkgdir}/usr/share/icons/hicolor/48x48/apps/yandex-music.png" - install -Dm644 "${TEMPDIR}/app/favicon.svg" "${pkgdir}/usr/share/icons/hicolor/scalable/apps/yandex-music.svg" - - install -Dm644 "./templates/desktop" "${pkgdir}/usr/share/applications/yandex-music.desktop" - install -Dm644 "./LICENSE.md" "${pkgdir}/usr/share/licenses/yandex-music/LICENSE" - mv "${TEMPDIR}/electron-${arch}/" "${pkgdir}/usr/lib/yandex-music/electron" - - echo "#!/bin/sh" > "${pkgdir}/usr/bin/yandex-music" - echo 'exec /usr/lib/yandex-music/electron/electron /usr/lib/yandex-music/yandex-music.asar "$@"' >> "${pkgdir}/usr/bin/yandex-music" - chmod 755 "${pkgdir}/usr/bin/yandex-music" + # extract tarball to pkgdir + tar -xzf "${TEMPDIR}/yandex-music_${version}_${arch}.tar.gz" -C "${pkgdir}" dpkg-deb --build "${pkgdir}" "deb/yandex-music_${version}_${pkgarch}.deb" } @@ -101,34 +86,20 @@ trap clear EXIT #loading version info with jq version=$(jq -r '.ym.version' ./utility/version_info.json) -exe_name=$(jq -r '.ym.exe_name' ./utility/version_info.json) -exe_link=$(jq -r '.ym.exe_link' ./utility/version_info.json) -exe_sha256=$(jq -r '.ym.exe_sha256' ./utility/version_info.json) - -#downloading exe -echo "Downloading ${exe_name}" -curl -L -o "${TEMPDIR}/${exe_name}" "${exe_link}" - -#checking sha256 -echo "Checking sha256" -echo "${exe_sha256} ${TEMPDIR}/${exe_name}" | sha256sum -c - -echo "Repaking ${exe_name}" -sh repack.sh -o "${TEMPDIR}/app" "${TEMPDIR}/${exe_name}" mkdir -p "deb" if [ ${x64} -eq 1 ]; then - download_electron_binary "x64" + prepare_tarball "x64" build_deb "x64" "amd64" fi if [ ${armv7l} -eq 1 ]; then - download_electron_binary "armv7l" + prepare_tarball "armv7l" build_deb "armv7l" "armhf" fi if [ ${arm64} -eq 1 ]; then - download_electron_binary "arm64" + prepare_tarball "arm64" build_deb "arm64" "arm64" fi \ No newline at end of file diff --git a/build_rpm.sh b/build_rpm.sh new file mode 100644 index 0000000..efa8c23 --- /dev/null +++ b/build_rpm.sh @@ -0,0 +1,115 @@ +#!/bin/bash + +set -e + +usage() { + echo "Usage: $(basename "$0") [-h] [-a default=x64]" + echo + echo " Options:" + echo " -a Architecture to build for ( default=x64)" + echo " -h Show this help and exit" +} + +prepare_tarball(){ + arch=${1} + echo "Preparing tarball for ${arch}" + if [ ! -f "tar/yandex-music_${version}_${arch}.tar.gz" ]; then + echo "Building tarball for ${arch}" + bash build_tarball.sh -a "${arch}" + fi + cp "tar/yandex-music_${version}_${arch}.tar.gz" "${TEMPDIR}/yandex-music_${version}_${arch}.tar.gz" + cd "${TEMPDIR}" + tar -xzf "yandex-music_${version}_${arch}.tar.gz" + mkdir -p "yandex-music-${version}" + mv usr "yandex-music-${version}" + tar -czf "yandex-music_${version}_${arch}.tar.gz" "yandex-music-${version}" + rm -rf "yandex-music-${version}" + cd "${INITIAL_DIR}" + cp "${TEMPDIR}/yandex-music_${version}_${arch}.tar.gz" "${TEMPDIR}/rpmbuild/SOURCES/yandex-music_${version}_${arch}.tar.gz" +} + +build_rpm(){ + arch=${1} + pkgarch=${2} + echo "Building ${arch} package" + cp "templates/rpm.spec" "${TEMPDIR}/rpmbuild/SPECS/${arch}.spec" + sed -i "s/%version%/${version}/g" "${TEMPDIR}/rpmbuild/SPECS/${arch}.spec" + sed -i "s/%arch%/${pkgarch}/g" "${TEMPDIR}/rpmbuild/SPECS/${arch}.spec" + sed -i "s/%source_tarball%/yandex-music_${version}_${arch}.tar.gz/g" "${TEMPDIR}/rpmbuild/SPECS/${arch}.spec" + rpmbuild --define "_topdir ${TEMPDIR}/rpmbuild" -bb "${TEMPDIR}/rpmbuild/SPECS/${arch}.spec" + cp "${TEMPDIR}/rpmbuild/RPMS/${pkgarch}/yandex-music-${version}-1.${pkgarch}.rpm" "rpm/yandex-music-${version}-1.${pkgarch}.rpm" +} + +init_rpm(){ + echo "Initializing RPM build" + mkdir -p "${TEMPDIR}/rpmbuild/SOURCES" + mkdir -p "${TEMPDIR}/rpmbuild/SPECS" +} + +x64=0 +armv7l=0 +arm64=0 + +#checking for arch option (if not specified set x64) and h option +while getopts :a:h name; do + case ${name} in + a) + case ${OPTARG} in + x64) x64=1 ;; + armv7l) armv7l=1 ;; + arm64) arm64=1 ;; + all) + x64=1 + armv7l=1 + arm64=1 + ;; + *) + echo "Invalid architecture specified" + usage + exit 1 + ;; + esac + ;; + h) + usage + exit 0 + ;; + *) + usage + exit 1 + ;; + esac +done + +#checking if at least one arch is specified else set x64 +if [ ${x64} -eq 0 ] && [ ${armv7l} -eq 0 ] && [ ${arm64} -eq 0 ]; then + x64=1 +fi + +clear() { + rm -rf "${TEMPDIR}" +} +TEMPDIR="$(mktemp -d)" +INITIAL_DIR=${PWD} +trap clear EXIT + +#loading version info with jq +version=$(jq -r '.ym.version' ./utility/version_info.json) + +init_rpm +mkdir -p "rpm" + +if [ ${x64} -eq 1 ]; then + prepare_tarball "x64" + build_rpm "x64" "x86_64" +fi + +if [ ${armv7l} -eq 1 ]; then + prepare_tarball "armv7l" + build_rpm "armv7l" "armv7hl" +fi + +if [ ${arm64} -eq 1 ]; then + prepare_tarball "arm64" + build_rpm "arm64" "aarch64" +fi \ No newline at end of file diff --git a/build_tarball.sh b/build_tarball.sh new file mode 100644 index 0000000..20a3791 --- /dev/null +++ b/build_tarball.sh @@ -0,0 +1,131 @@ +#!/bin/bash + +set -e + +usage() { + echo "Usage: $(basename "$0") [-h] [-a default=x64]" + echo + echo " Options:" + echo " -a Architecture to build for ( default=x64)" + echo " -o Output directory" + echo " -h Show this help and exit" +} + +download_electron_binary(){ + arch=${1} + echo "Downloading electron ${arch}" + LINK=$(jq -r .electron."${arch}" ./utility/version_info.json) + curl -L -o "${TEMPDIR}/electron-${arch}.zip" "${LINK}" + unzip -q "${TEMPDIR}/electron-${arch}.zip" -d "${TEMPDIR}/electron-${arch}" +} + +build_tarball(){ + arch=${1} + app_dir="${TEMPDIR}/yandex-music_${version}_${arch}" + + mkdir -p "${app_dir}/usr/lib/yandex-music" + mkdir -p "${app_dir}/usr/share/applications" + mkdir -p "${app_dir}/usr/share/licenses/yandex-music" + mkdir -p "${app_dir}/usr/share/pixmaps" + mkdir -p "${app_dir}/usr/bin" + + install -Dm644 "${TEMPDIR}/app/yandex-music.asar" "${app_dir}/usr/lib/yandex-music/yandex-music.asar" + + install -Dm644 "${TEMPDIR}/app/favicon.png" "${app_dir}/usr/share/pixmaps/yandex-music.png" + install -Dm644 "${TEMPDIR}/app/favicon.png" "${app_dir}/usr/share/icons/hicolor/48x48/apps/yandex-music.png" + install -Dm644 "${TEMPDIR}/app/favicon.svg" "${app_dir}/usr/share/icons/hicolor/scalable/apps/yandex-music.svg" + + install -Dm644 "./templates/desktop" "${app_dir}/usr/share/applications/yandex-music.desktop" + install -Dm644 "./LICENSE.md" "${app_dir}/usr/share/licenses/yandex-music/LICENSE" + mv "${TEMPDIR}/electron-${arch}/" "${app_dir}/usr/lib/yandex-music/electron" + + echo "#!/bin/sh" > "${app_dir}/usr/bin/yandex-music" + echo 'exec /usr/lib/yandex-music/electron/electron /usr/lib/yandex-music/yandex-music.asar "$@"' >> "${app_dir}/usr/bin/yandex-music" + chmod 755 "${app_dir}/usr/bin/yandex-music" + + cd "${app_dir}" + tar cvfz "${OUTPUT_DIR}/yandex-music_${version}_${arch}.tar.gz" * + cd "${INITIAL_DIR}" +} + +INITIAL_DIR="${PWD}" +OUTPUT_DIR="${PWD}/tar" +x64=0 +armv7l=0 +arm64=0 + +#checking for arch option (if not specified set x64) and h option +while getopts :a:h name; do + case ${name} in + a) + case ${OPTARG} in + x64) x64=1 ;; + armv7l) armv7l=1 ;; + arm64) arm64=1 ;; + all) + x64=1 + armv7l=1 + arm64=1 + ;; + *) + echo "Invalid architecture specified" + usage + exit 1 + ;; + esac + ;; + h) + usage + exit 0 + ;; + *) + usage + exit 1 + ;; + esac +done + +#checking if at least one arch is specified else set x64 +if [ ${x64} -eq 0 ] && [ ${armv7l} -eq 0 ] && [ ${arm64} -eq 0 ]; then + x64=1 +fi + +clear() { + rm -rf "${TEMPDIR}" +} +TEMPDIR="$(mktemp -d)" +trap clear EXIT + +#loading version info with jq +version=$(jq -r '.ym.version' ./utility/version_info.json) +exe_name=$(jq -r '.ym.exe_name' ./utility/version_info.json) +exe_link=$(jq -r '.ym.exe_link' ./utility/version_info.json) +exe_sha256=$(jq -r '.ym.exe_sha256' ./utility/version_info.json) + +#downloading exe +echo "Downloading ${exe_name}" +curl -L -o "${TEMPDIR}/${exe_name}" "${exe_link}" + +#checking sha256 +echo "Checking sha256" +echo "${exe_sha256} ${TEMPDIR}/${exe_name}" | sha256sum -c + +echo "Repaking ${exe_name}" +bash repack.sh -o "${TEMPDIR}/app" "${TEMPDIR}/${exe_name}" + +mkdir -p "${OUTPUT_DIR}" + +if [ ${x64} -eq 1 ]; then + download_electron_binary "x64" + build_tarball "x64" +fi + +if [ ${armv7l} -eq 1 ]; then + download_electron_binary "armv7l" + build_tarball "armv7l" +fi + +if [ ${arm64} -eq 1 ]; then + download_electron_binary "arm64" + build_tarball "arm64" +fi \ No newline at end of file diff --git a/flake.lock b/flake.lock index 919baa5..54f2b75 100644 --- a/flake.lock +++ b/flake.lock @@ -56,13 +56,13 @@ "ymExe": { "flake": false, "locked": { - "narHash": "sha256-a7D/8m6ECtYsep7mD9SqI8zFbWxFcjVJ4ELDWcxsWHA=", + "narHash": "sha256-6YOx1r40nBcexbeqmQn5/FkuUaHxRrg4Qn1mEwPVnTs=", "type": "file", - "url": "https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.12.exe" + "url": "https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.14.exe" }, "original": { "type": "file", - "url": "https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.12.exe" + "url": "https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.14.exe" } } }, diff --git a/flake.nix b/flake.nix index 4c12d76..eb705bf 100644 --- a/flake.nix +++ b/flake.nix @@ -1,34 +1,41 @@ { description = "Native Yandex Music desktop client"; + inputs = { - ymExe.url = https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.12.exe; + ymExe.url = https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.14.exe; ymExe.flake = false; }; + outputs = { self, ymExe, nixpkgs, flake-utils }: - let - yandex-music-with = pkgs: pkgs.callPackage ./nix { - inherit ymExe; - }; - in - flake-utils.lib.eachDefaultSystem - (system: - let - pkgs = import nixpkgs { inherit system; }; - in - { - packages = rec { - yandex-music = yandex-music-with pkgs; - yandex-music-noflakes = pkgs.callPackage ./nix {}; - default = yandex-music; - }; - } - ) // { - modules = [{ + let + yandex-music-with = pkgs: pkgs.callPackage ./nix { + inherit ymExe; + }; + in + flake-utils.lib.eachDefaultSystem + (system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + packages = rec { + yandex-music = yandex-music-with pkgs; + yandex-music-noflakes = pkgs.callPackage ./nix {}; + default = yandex-music; + }; + } + ) // { + nixosModules = rec { + yandex-music = { nixpkgs.overlays = [ (final: prev: { yandex-music = yandex-music-with prev; }) ]; - }]; + }; + default = yandex-music; }; + + nixosModule = self.nixosModules.default; + }; } diff --git a/icons/apple-touch-icon.png b/icons/apple-touch-icon.png new file mode 100644 index 0000000..61d2fb9 Binary files /dev/null and b/icons/apple-touch-icon.png differ diff --git a/icons/favicon.png b/icons/favicon.png new file mode 100644 index 0000000..8fb90ee Binary files /dev/null and b/icons/favicon.png differ diff --git a/icons/favicon.svg b/icons/favicon.svg new file mode 100644 index 0000000..86f375c --- /dev/null +++ b/icons/favicon.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/nix/default.nix b/nix/default.nix index 1dad376..95b6638 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -30,6 +30,7 @@ stdenvNoCC.mkDerivation repack = ./../repack.sh; patches = ./../patches; utility = ./../utility; + icons = ./../icons; desktopItem = ../templates/desktop; src = if ymExe != null @@ -44,6 +45,7 @@ stdenvNoCC.mkDerivation cp -r $repack ./repack.sh cp -r $patches ./patches cp -r $utility ./utility + cp -r $icons ./icons bash "./repack.sh" -o "./app" "$src" ''; dontPatch = true; diff --git a/patches/0001-Add-package-licence.patch b/patches/0001-Add-package-licence.patch index 7a4c3a5..13bb32b 100644 --- a/patches/0001-Add-package-licence.patch +++ b/patches/0001-Add-package-licence.patch @@ -9,4 +9,3 @@ diff --git a/package.json b/package.json + }, + "license": "UNLICENSED" } --- diff --git a/patches/0002-Add-package-icon.patch b/patches/0002-Add-package-icon.patch index e464f38..b8d42ba 100644 --- a/patches/0002-Add-package-icon.patch +++ b/patches/0002-Add-package-icon.patch @@ -12,4 +12,3 @@ diff --git a/package.json b/package.json + "scalable": "build/next-desktop/favicon.svg" + } } --- diff --git a/patches/0004-Fix-window-resize.patch b/patches/0004-Fix-window-resize.patch index adb1287..c1c9ae1 100644 --- a/patches/0004-Fix-window-resize.patch +++ b/patches/0004-Fix-window-resize.patch @@ -5,8 +5,8 @@ diff --git a/main/lib/createWindow.js b/main/lib/createWindow.js x: 16, y: 10 }, -- minWidth: 1024, -- minHeight: 800, +- minWidth: 768, +- minHeight: 650, width: 1280, height: 800, webPreferences: { diff --git a/repack.sh b/repack.sh index 5087d14..7ce5e27 100755 --- a/repack.sh +++ b/repack.sh @@ -19,7 +19,7 @@ nopatch=0 while getopts :xo:ph name; do case $name in x) extract_only=1 ;; - o) dst="$OPTARG" ;; + o) dst="$(realpath "$OPTARG")" ;; p) nopatch=1 ;; h) usage @@ -83,6 +83,10 @@ find "./" -type f -name "*.html" -print0 | while IFS= read -r -d $'\0' file; do done echo "Title Fixed" +echo "Replacing Icons" +cp -drf "$SCRIPT_DIR/icons/." "./build/next-desktop/" +echo "Replaced Icons" + # applying patches # This function accepts patch file. If it names starts with `XXXX-optional`, diff --git a/templates/PKGBUILD b/templates/PKGBUILD index 5859f91..c536739 100644 --- a/templates/PKGBUILD +++ b/templates/PKGBUILD @@ -14,7 +14,7 @@ source=("%exe_link%" "git+https://github.com/cucumber-sp/yandex-music-linux") sha256sums=("%exe_sha256%" "SKIP") build() { - sh "$srcdir/yandex-music-linux/repack.sh" "$srcdir/%exe_name%" + bash "$srcdir/yandex-music-linux/repack.sh" "$srcdir/%exe_name%" } package() { diff --git a/templates/desktop b/templates/desktop index 83e13e6..ff34882 100644 --- a/templates/desktop +++ b/templates/desktop @@ -4,7 +4,7 @@ Name[ru]=Яндекс Музыка Comment=Yandex Music — we collect music for you Comment[ru]=Яндекс Музыка — собираем музыку для вас GenericName=YandexMusic -Exec=yandex-music %U +Exec=yandex-music --no-sandbox %U Icon=yandex-music Type=Application StartupNotify=true diff --git a/templates/rpm.spec b/templates/rpm.spec new file mode 100644 index 0000000..d09bb93 --- /dev/null +++ b/templates/rpm.spec @@ -0,0 +1,33 @@ +Name: yandex-music +Version: %version% +Release: 1 +Summary: Yandex Music Client +License: Custom +URL: https://github.com/cucumber-sp/yandex-music-linux + +Source0: %source_tarball% + +BuildArch: %arch% + +Requires: (kde-cli-tools or kde-cli-tools5 or kde-runtime or trash-cli or glib2 or gvfs-client), (libXtst or libXtst6), (libnotify or libnotify4), (libxcb or libxcb1), (mesa-libgbm or libgbm1), (nss or mozilla-nss), at-spi2-core, gtk3, libdrm, xdg-utils + +%description +Yandex Music - Personal recommendations, selections for any occasion and new music + +%prep +%setup -q + +%install + +cp -r ./usr %{buildroot}/ +chmod 755 %{buildroot}/usr/bin/yandex-music + + +%files +/usr/bin/yandex-music +/usr/lib/yandex-music +/usr/share/applications/yandex-music.desktop +/usr/share/icons/hicolor/48x48/apps/yandex-music.png +/usr/share/icons/hicolor/scalable/apps/yandex-music.svg +/usr/share/licenses/yandex-music +/usr/share/pixmaps/yandex-music.png \ No newline at end of file diff --git a/utility/version_info.json b/utility/version_info.json index 0e474f3..c7d3413 100644 --- a/utility/version_info.json +++ b/utility/version_info.json @@ -1,14 +1,14 @@ { "ym": { - "version": "5.0.12", - "exe_name": "Yandex_Music_x64_5.0.12.exe", - "exe_link": "https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.12.exe", - "exe_sha256": "4ebeac9620f60e9e2333114cf8c8fb3dc6f2c2c70da58ba56902aa75d65ce4f8" + "version": "5.0.14", + "exe_name": "Yandex_Music_x64_5.0.14.exe", + "exe_link": "https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.14.exe", + "exe_sha256": "c10c6c4b5d596f9bf490a231d7c13bbd2627109f71c9c57aa4e2b034e31252f4" }, "electron": { - "version": "27.3.3", - "x64": "https://github.com/electron/electron/releases/download/v27.3.3/electron-v27.3.3-linux-x64.zip", - "armv7l": "https://github.com/electron/electron/releases/download/v27.3.3/electron-v27.3.3-linux-armv7l.zip", - "arm64": "https://github.com/electron/electron/releases/download/v27.3.3/electron-v27.3.3-linux-arm64.zip" + "version": "27.3.5", + "x64": "https://github.com/electron/electron/releases/download/v27.3.5/electron-v27.3.5-linux-x64.zip", + "armv7l": "https://github.com/electron/electron/releases/download/v27.3.5/electron-v27.3.5-linux-armv7l.zip", + "arm64": "https://github.com/electron/electron/releases/download/v27.3.5/electron-v27.3.5-linux-arm64.zip" } } \ No newline at end of file