0
0
mirror of https://github.com/cucumber-sp/yandex-music-linux.git synced 2024-12-23 22:22:59 +03:00

Merge pull request #3 from ein-shved/main

nix: add desktop item and fix names
This commit is contained in:
Andrey Onishchenko 2024-01-15 12:32:15 +03:00 committed by GitHub
commit fa262f64f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 34 deletions

View File

@ -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}
'';
}

View File

@ -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;
})
];
}];

48
nix/default.nix Normal file
View File

@ -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 ];
}

View File

@ -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.