mirror of
https://github.com/cucumber-sp/yandex-music-linux.git
synced 2024-12-23 22:22:59 +03:00
commit
5b9fd6fa77
27
README.md
27
README.md
@ -244,27 +244,24 @@ nix-build --expr '(import <nixpkgs> {}).callPackage ./nix {}'
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Import module in your `configuration.nix` or `home-manager.nix`
|
2. Import module in your `configuration.nix`:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
imports = [
|
imports = [
|
||||||
yandex-music.nixosModule
|
yandex-music.nixosModules.default
|
||||||
];
|
];
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Add package `yandex-music`
|
or in `home-manager.nix`:
|
||||||
|
```nix
|
||||||
|
imports = [
|
||||||
|
yandex-music.homeManagerModules.default
|
||||||
|
];
|
||||||
|
```
|
||||||
|
|
||||||
For `configuration.nix`:
|
|
||||||
|
3. Enable `yandex-music`
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
environment.systemPackages = with pkgs; [
|
programs.yandex-music.enable = true;
|
||||||
yandex-music
|
programs.yandex-music.tray.enable = true; # to enable tray support
|
||||||
];
|
|
||||||
```
|
|
||||||
For Home Manager:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
yandex-music
|
|
||||||
];
|
|
||||||
```
|
```
|
||||||
|
@ -34,7 +34,7 @@ build_tarball(){
|
|||||||
install -Dm644 "${TEMPDIR}/app/favicon.png" "${app_dir}/usr/share/pixmaps/yandex-music.png"
|
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.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 "${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 "./templates/desktop" "${app_dir}/usr/share/applications/yandex-music.desktop"
|
||||||
install -Dm644 "./templates/default.conf" "${app_dir}/usr/lib/yandex-music/default.conf"
|
install -Dm644 "./templates/default.conf" "${app_dir}/usr/lib/yandex-music/default.conf"
|
||||||
install -Dm644 "./LICENSE.md" "${app_dir}/usr/share/licenses/yandex-music/LICENSE"
|
install -Dm644 "./LICENSE.md" "${app_dir}/usr/share/licenses/yandex-music/LICENSE"
|
||||||
@ -42,6 +42,7 @@ build_tarball(){
|
|||||||
|
|
||||||
install -Dm755 "./templates/yandex-music.sh" "${app_dir}/usr/bin/yandex-music"
|
install -Dm755 "./templates/yandex-music.sh" "${app_dir}/usr/bin/yandex-music"
|
||||||
sed -i "s|%electron_path%|/usr/lib/yandex-music/electron/electron|g" "${app_dir}/usr/bin/yandex-music"
|
sed -i "s|%electron_path%|/usr/lib/yandex-music/electron/electron|g" "${app_dir}/usr/bin/yandex-music"
|
||||||
|
sed -i "s|%asar_path%|/usr/lib/yandex-music/yandex-music.asar|g" "${app_dir}/usr/bin/yandex-music"
|
||||||
|
|
||||||
cd "${app_dir}"
|
cd "${app_dir}"
|
||||||
tar -czf "${OUTPUT_DIR}/yandex-music_${version}_${arch}.tar.gz" *
|
tar -czf "${OUTPUT_DIR}/yandex-music_${version}_${arch}.tar.gz" *
|
||||||
@ -128,4 +129,4 @@ fi
|
|||||||
if [ ${arm64} -eq 1 ]; then
|
if [ ${arm64} -eq 1 ]; then
|
||||||
download_electron_binary "arm64"
|
download_electron_binary "arm64"
|
||||||
build_tarball "arm64"
|
build_tarball "arm64"
|
||||||
fi
|
fi
|
||||||
|
56
flake.nix
56
flake.nix
@ -7,35 +7,33 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, ymExe, nixpkgs, flake-utils }:
|
outputs = { self, ymExe, nixpkgs, flake-utils }:
|
||||||
let
|
let
|
||||||
yandex-music-with = pkgs: pkgs.callPackage ./nix {
|
yandex-music-with = pkgs: pkgs.callPackage ./nix {
|
||||||
inherit ymExe;
|
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;
|
modules = isHm: rec {
|
||||||
};
|
yandex-music = {
|
||||||
|
imports = [ (import ./nix/module.nix { inherit isHm yandex-music-with; }) ];
|
||||||
|
};
|
||||||
|
default = yandex-music;
|
||||||
|
};
|
||||||
|
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 = modules false;
|
||||||
|
homeManagerModules = modules true;
|
||||||
|
|
||||||
nixosModule = self.nixosModules.default;
|
nixosModule = self.nixosModules.default;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
, electron
|
, electron
|
||||||
|
|
||||||
, ymExe ? null
|
, ymExe ? null
|
||||||
|
, electronArguments ? ""
|
||||||
|
, trayEnabled ? false
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
version_info = with builtins; fromJSON (readFile ../utility/version_info.json);
|
version_info = with builtins; fromJSON (readFile ../utility/version_info.json);
|
||||||
@ -32,6 +34,7 @@ stdenvNoCC.mkDerivation
|
|||||||
utility = ./../utility;
|
utility = ./../utility;
|
||||||
icons = ./../icons;
|
icons = ./../icons;
|
||||||
desktopItem = ../templates/desktop;
|
desktopItem = ../templates/desktop;
|
||||||
|
ymScript = ../templates/yandex-music.sh;
|
||||||
src =
|
src =
|
||||||
if ymExe != null
|
if ymExe != null
|
||||||
then ymExe
|
then ymExe
|
||||||
@ -54,10 +57,17 @@ stdenvNoCC.mkDerivation
|
|||||||
mkdir -p "$out/share/nodejs"
|
mkdir -p "$out/share/nodejs"
|
||||||
mv app/yandex-music.asar "$out/share/nodejs"
|
mv app/yandex-music.asar "$out/share/nodejs"
|
||||||
|
|
||||||
# use makeWrapper on electron binary to make it call our asar package
|
CONFIG_FILE="$out/share/yandex-music.conf"
|
||||||
makeWrapper "${electron}/bin/electron" "$out/bin/yandex-music" \
|
echo "TRAY_ENABLED=${if trayEnabled then "1" else "0"}" >> "$CONFIG_FILE"
|
||||||
--add-flags "$out/share/nodejs/yandex-music.asar" \
|
echo "ELECTRON_ARGS=\"${electronArguments}\"" >> "$CONFIG_FILE"
|
||||||
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--enable-features=UseOzonePlatform --ozone-platform=wayland}}"
|
|
||||||
|
|
||||||
|
install -Dm755 "$ymScript" "$out/bin/yandex-music"
|
||||||
|
sed -i "s|%electron_path%|${electron}/bin/electron|g" "$out/bin/yandex-music"
|
||||||
|
sed -i "s|%asar_path%|$out/share/nodejs/yandex-music.asar|g" "$out/bin/yandex-music"
|
||||||
|
|
||||||
|
wrapProgram "$out/bin/yandex-music" \
|
||||||
|
--set-default YANDEX_MUSIC_CONFIG "$CONFIG_FILE"
|
||||||
|
|
||||||
install -Dm644 "./app/favicon.png" "$out/share/pixmaps/yandex-music.png"
|
install -Dm644 "./app/favicon.png" "$out/share/pixmaps/yandex-music.png"
|
||||||
install -Dm644 "./app/favicon.png" "$out/share/icons/hicolor/48x48/apps/yandex-music.png"
|
install -Dm644 "./app/favicon.png" "$out/share/icons/hicolor/48x48/apps/yandex-music.png"
|
||||||
|
53
nix/module.nix
Normal file
53
nix/module.nix
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
{ yandex-music-with
|
||||||
|
, isHm ? false
|
||||||
|
}:
|
||||||
|
{ lib, pkgs, config, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.programs.yandex-music;
|
||||||
|
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [{
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
(final: prev: {
|
||||||
|
yandex-music = yandex-music-with prev;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
}];
|
||||||
|
|
||||||
|
options = {
|
||||||
|
programs.yandex-music = {
|
||||||
|
enable = lib.mkEnableOption "yandex music application";
|
||||||
|
tray.enable = lib.mkEnableOption "tray icon for yandex music application";
|
||||||
|
electronArguments = lib.mkOption {
|
||||||
|
description = "Extra electron arguments";
|
||||||
|
example = "--no-sandbox --trace-warnings";
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "";
|
||||||
|
};
|
||||||
|
package = lib.mkOption {
|
||||||
|
description = "Finalized package of yandex music application";
|
||||||
|
type = lib.types.package;
|
||||||
|
default = pkgs.yandex-music.override {
|
||||||
|
trayEnabled = cfg.tray.enable;
|
||||||
|
electronArguments = cfg.electronArguments;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable (
|
||||||
|
if isHm then
|
||||||
|
{
|
||||||
|
home.packages = [
|
||||||
|
cfg.package
|
||||||
|
];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
environment.systemPackages = [
|
||||||
|
cfg.package
|
||||||
|
];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
@ -36,4 +36,5 @@ package() {
|
|||||||
|
|
||||||
install -Dm755 "$srcdir/yandex-music-linux/templates/yandex-music.sh" "$pkgdir/usr/bin/yandex-music"
|
install -Dm755 "$srcdir/yandex-music-linux/templates/yandex-music.sh" "$pkgdir/usr/bin/yandex-music"
|
||||||
sed -i "s|%electron_path%|/usr/bin/electron29|g" "$pkgdir/usr/bin/yandex-music"
|
sed -i "s|%electron_path%|/usr/bin/electron29|g" "$pkgdir/usr/bin/yandex-music"
|
||||||
|
sed -i "s|%asar_path%|/usr/lib/yandex-music/yandex-music.asar|g" "$pkgdir/usr/bin/yandex-music"
|
||||||
}
|
}
|
||||||
|
@ -24,4 +24,4 @@ ELECTRON_BIN=${ELECTRON_CUSTOM_BIN:-%electron_path%}
|
|||||||
|
|
||||||
export TRAY_ENABLED=${TRAY_ENABLED:-0}
|
export TRAY_ENABLED=${TRAY_ENABLED:-0}
|
||||||
|
|
||||||
exec "${ELECTRON_BIN}" "/usr/lib/yandex-music/yandex-music.asar" $ELECTRON_ARGS $WAYLAND_FLAGS
|
exec "${ELECTRON_BIN}" "%asar_path%" $ELECTRON_ARGS $WAYLAND_FLAGS
|
||||||
|
Loading…
Reference in New Issue
Block a user