diff --git a/default.nix b/default.nix deleted file mode 100644 index ee1d4e1..0000000 --- a/default.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ fetchurl -, runCommand -, writeShellApplication - -, p7zip -, asar -, electron -, jq - -, ymExe -}: -let - app = runCommand "yandex_music_app" - { - nativeBuildInputs = [ p7zip asar jq ]; - repack = ./repack.sh; - src = ymExe; - } '' - bash "$repack" -xl "$src" - mv ./app "$out" - ''; -in -writeShellApplication { - name = "yandex_music"; - runtimeInputs = [ electron ]; - text = '' - electron ${app} - ''; -} diff --git a/flake.nix b/flake.nix index a103cd8..b12d449 100644 --- a/flake.nix +++ b/flake.nix @@ -8,7 +8,7 @@ }; outputs = { self, ymExe, nixpkgs, flake-utils }: let - yandex_music_with = pkgs: pkgs.callPackage ./. { + yandex-music-with = pkgs: pkgs.callPackage ./nix { inherit ymExe; }; in @@ -19,15 +19,15 @@ in { packages = rec { - yandex_music = yandex_music_with pkgs; - default = yandex_music; + yandex-music = yandex-music-with pkgs; + default = yandex-music; }; } ) // { modules = [{ nixpkgs.overlays = [ (final: prev: { - yandex_music = yandex_music_with prev; + yandex-music = yandex-music-with prev; }) ]; }]; diff --git a/nix/default.nix b/nix/default.nix new file mode 100644 index 0000000..5a7dbea --- /dev/null +++ b/nix/default.nix @@ -0,0 +1,48 @@ +{ fetchurl +, runCommand +, writeShellApplication +, makeDesktopItem +, symlinkJoin + +, p7zip +, asar +, electron +, jq + +, ymExe +}: +let + app = runCommand "yandex-music-app" + { + nativeBuildInputs = [ p7zip asar jq ]; + repack = ./../repack.sh; + src = ymExe; + } '' + bash "$repack" -xl "$src" + mv ./app "$out" + ''; + launcher = writeShellApplication { + name = "yandex-music"; + runtimeInputs = [ electron ]; + text = '' + electron ${app} "$@" + ''; + }; + desktopItem = makeDesktopItem { + name = "yandex-music"; + desktopName = "Yandex Music"; + comment = "Yandex Music - we collect music for you"; + exec = "${launcher}/bin/yandex-music"; + terminal = false; + icon = "${app}/build/next-desktop/favicon.svg"; + categories = [ "Audio" "Music" "Player" "AudioVideo" ]; + extraConfig = { + "Name[ru]" = "Яндекс Музыка"; + "Comment[ru]" = "Яндекс Музыка — собираем музыку для вас"; + }; + }; +in +symlinkJoin { + name = "yandex-music"; + paths = [ launcher desktopItem ]; +} diff --git a/translated readme b/translated readme index 607ea26..67e46c1 100644 --- a/translated readme +++ b/translated readme @@ -20,4 +20,4 @@ You can install this app with dep and rpm packages, or by extracting archive fil ## NixOs Запустите `nix run` в корне этого репозитория, чтобы запустить приложение. Так же вы можете использовать поле `modules` из flake этого репозитория. Добавив его -в модули вашей системы, вы получите пакет `yandex_music` в коллекции pkgs. +в модули вашей системы, вы получите пакет `yandex-music` в коллекции pkgs.