switch to apple type c to 3.5mm adapter for music-player.target
This commit is contained in:
parent
02f43fc950
commit
bb1d36cf8e
|
@ -91,7 +91,7 @@ in {
|
||||||
"--vfs-cache-max-age=5m"
|
"--vfs-cache-max-age=5m"
|
||||||
"--vfs-cache-max-size=1g"
|
"--vfs-cache-max-size=1g"
|
||||||
"--vfs-cache-mode=full"
|
"--vfs-cache-mode=full"
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
id = "notes";
|
id = "notes";
|
||||||
|
|
|
@ -4,25 +4,26 @@
|
||||||
tree,
|
tree,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
alsaDevice = "sysdefault:CARD=BTR3K";
|
alsaDevice = "sysdefault:CARD=A";
|
||||||
pipewireDevice = "alsa_output.usb-FiiO_FiiO_BTR3K_ABCDEF0123456789-00.analog-stereo";
|
alsaControl = "Headphone";
|
||||||
hardwareVolume = 75;
|
mpvDevice = "alsa/${alsaDevice}";
|
||||||
|
hardwareVolume = 80;
|
||||||
|
|
||||||
startMusicPlayer = pkgs.writeShellScriptBin "startMusicPlayer" ''
|
startMusicPlayer = pkgs.writeShellScriptBin "startMusicPlayer" ''
|
||||||
|
${pkgs.alsa-utils}/bin/amixer -D "${alsaDevice}" sset "${alsaControl}" "${toString hardwareVolume}%"
|
||||||
|
|
||||||
exec ${pkgs.mpv}/bin/mpv \
|
exec ${pkgs.mpv}/bin/mpv \
|
||||||
"https://music:$(cat /secrets/music_stream_password)@mpd.owo.monster/flac" \
|
"https://music:$(cat /secrets/music_stream_password)@mpd.owo.monster/flac" \
|
||||||
--cache=yes --cache-pause-initial=yes --cache-pause-wait=5 \
|
--cache=yes --cache-pause-initial=yes --cache-pause-wait=5 \
|
||||||
--vo=gpu --force-window --script-opts-append=osc-visibility=always \
|
--vo=gpu --force-window --script-opts-append=osc-visibility=always \
|
||||||
--ao=pipewire --audio-device="pipewire/${pipewireDevice}"
|
--ao=alsa --audio-device="${mpvDevice}"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
startMusicPlayerSession = pkgs.writeShellScriptBin "startMusicPlayerSession" ''
|
startMusicPlayerSession = pkgs.writeShellScriptBin "startMusicPlayerSession" ''
|
||||||
set -x
|
set -x
|
||||||
export XDG_RUNTIME_DIR=/run/user/$UID
|
export XDG_RUNTIME_DIR=/run/user/$UID
|
||||||
|
|
||||||
dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
|
dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
|
||||||
systemctl --user start dbus pipewire
|
|
||||||
|
|
||||||
${pkgs.alsa-utils}/bin/amixer -D ${alsaDevice} sset PCM "${toString hardwareVolume}%"
|
|
||||||
|
|
||||||
exec systemd-inhibit --what=sleep:idle:handle-lid-switch ${startMusicPlayer}/bin/startMusicPlayer
|
exec systemd-inhibit --what=sleep:idle:handle-lid-switch ${startMusicPlayer}/bin/startMusicPlayer
|
||||||
'';
|
'';
|
||||||
|
@ -35,6 +36,7 @@ in {
|
||||||
environment.systemPackages = [startMusicPlayer startMusicPlayerSession];
|
environment.systemPackages = [startMusicPlayer startMusicPlayerSession];
|
||||||
|
|
||||||
users.users.music-player = {
|
users.users.music-player = {
|
||||||
|
uid = 1001;
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
linger = true;
|
linger = true;
|
||||||
extraGroups = [
|
extraGroups = [
|
||||||
|
@ -49,8 +51,6 @@ in {
|
||||||
programs.mpv.enable = true;
|
programs.mpv.enable = true;
|
||||||
imports = with tree; [
|
imports = with tree; [
|
||||||
home.base
|
home.base
|
||||||
home.apps.kitty
|
|
||||||
home.apps.pavucontrol
|
|
||||||
];
|
];
|
||||||
home.stateVersion = "23.05";
|
home.stateVersion = "23.05";
|
||||||
};
|
};
|
||||||
|
@ -63,10 +63,11 @@ in {
|
||||||
"plymouth-quit.service"
|
"plymouth-quit.service"
|
||||||
"systemd-logind.service"
|
"systemd-logind.service"
|
||||||
"getty@tty1.service"
|
"getty@tty1.service"
|
||||||
|
"user@1001.service"
|
||||||
"network.target"
|
"network.target"
|
||||||
];
|
];
|
||||||
before = ["music-player.target"];
|
before = ["music-player.target"];
|
||||||
wants = ["dbus.socket" "network.target" "systemd-logind.service" "plymouth-quit.service"];
|
wants = ["dbus.socket" "network.target" "user@1001.service" "systemd-logind.service" "plymouth-quit.service"];
|
||||||
wantedBy = ["music-player.target"];
|
wantedBy = ["music-player.target"];
|
||||||
conflicts = ["getty@tty1.service"];
|
conflicts = ["getty@tty1.service"];
|
||||||
|
|
||||||
|
@ -77,8 +78,7 @@ in {
|
||||||
${pkgs.cage}/bin/cage -s ${startMusicPlayerSession}/bin/startMusicPlayerSession
|
${pkgs.cage}/bin/cage -s ${startMusicPlayerSession}/bin/startMusicPlayerSession
|
||||||
'';
|
'';
|
||||||
User = "music-player";
|
User = "music-player";
|
||||||
StandardOutput = "append:/var/log/music-player.log";
|
StandardError = "append:/var/log/music-player.log";
|
||||||
StandardError = "inherit";
|
|
||||||
IgnoreSIGPIPE = "no";
|
IgnoreSIGPIPE = "no";
|
||||||
UtmpIdentifier = "%n";
|
UtmpIdentifier = "%n";
|
||||||
UtmpMode = "user";
|
UtmpMode = "user";
|
||||||
|
@ -109,6 +109,6 @@ in {
|
||||||
|
|
||||||
systemd.targets.music-player = {
|
systemd.targets.music-player = {
|
||||||
description = "Music player";
|
description = "Music player";
|
||||||
wants = ["music-player.service" "networkmanager.service"];
|
wants = ["music-player.service" "networkmanager.service" "user@1001.service"];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue