feat(linux): add apple-music chrome app

This commit is contained in:
winston 2023-10-19 07:06:38 +02:00
parent 0d2d83c167
commit 3d4d3ba393
Signed by: winston
GPG key ID: 3786770EDBC2B481
2 changed files with 57 additions and 1 deletions

View file

@ -1,4 +1,8 @@
{pkgs, ...}: let {
lib,
pkgs,
...
}: let
inherit (pkgs.stdenv.hostPlatform) isDarwin isLinux; inherit (pkgs.stdenv.hostPlatform) isDarwin isLinux;
in { in {
programs.imv = { programs.imv = {
@ -7,6 +11,8 @@ in {
programs.mpv.enable = isLinux; programs.mpv.enable = isLinux;
programs.zathura.enable = isLinux; programs.zathura.enable = isLinux;
home.packages = lib.mkIf isLinux [(pkgs.callPackage ../../pkgs/apple-music.nix {})];
services.discord-applemusic-rich-presence.enable = isDarwin; services.discord-applemusic-rich-presence.enable = isDarwin;
xdg.mimeApps.defaultApplications = { xdg.mimeApps.defaultApplications = {

50
pkgs/apple-music.nix Normal file
View file

@ -0,0 +1,50 @@
{
fetchurl,
google-chrome,
lib,
makeDesktopItem,
runtimeShell,
symlinkJoin,
writeScriptBin,
# command line arguments which are always set e.g "--disable-gpu"
commandLineArgs ? [],
}: let
name = "apple-music-via-google-chrome";
meta = {
description = "Open Apple Music in Google Chrome app mode";
homepage = google-chrome.meta.homepage or null;
license = lib.licenses.unfree;
maintainers = [lib.maintainers.roberth];
platforms = google-chrome.meta.platforms or lib.platforms.all;
};
desktopItem = makeDesktopItem {
inherit name;
exec = name;
icon = fetchurl {
name = "apple-music-icon.png";
url = "https://music.apple.com/assets/favicon/favicon-180.png";
sha256 = "sha256-lZXt+kbYCBTLzK1S9QcxVwIhin2x8iNUAcrSHtmWmOY=";
meta.license = lib.licenses.unfree;
};
desktopName = "Apple Music via Google Chrome";
genericName = "Music streaming service";
categories = ["AudioVideo"];
startupNotify = true;
};
script = writeScriptBin name ''
#!${runtimeShell}
exec ${google-chrome}/bin/${google-chrome.meta.mainProgram} ${lib.escapeShellArgs commandLineArgs} \
--app=https://music.apple.com/browse?l=en_US \
--no-first-run \
--no-default-browser-check \
--no-crash-upload \
"$@"
'';
in
symlinkJoin {
inherit name meta;
paths = [script desktopItem];
}