From c3c787eecbc309b0263b568927bb984ee4e4d05a Mon Sep 17 00:00:00 2001 From: Yury Shvedov Date: Mon, 15 Jan 2024 10:52:43 +0300 Subject: [PATCH] nix: add desktop item and fix names Move default.nix to nix folder Rename yandex_music to yandex-music to be more nix-styled Add generation of yandex-music.desktop file Change-Id: Id0f3bebc22e50ce51be13615ef47717277eb8e3d --- default.nix | 29 ---------------------------- flake.nix | 8 ++++---- nix/default.nix | 48 +++++++++++++++++++++++++++++++++++++++++++++++ translated readme | 2 +- 4 files changed, 53 insertions(+), 34 deletions(-) delete mode 100644 default.nix create mode 100644 nix/default.nix 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.