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

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
This commit is contained in:
Yury Shvedov 2024-01-15 10:52:43 +03:00
parent cb88114c48
commit c3c787eecb
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.