switch to apple type c to 3.5mm adapter for music-player.target

This commit is contained in:
chaos 2024-05-09 08:19:31 +01:00
parent 02f43fc950
commit bb1d36cf8e
No known key found for this signature in database
4 changed files with 18 additions and 18 deletions

View file

@ -23,7 +23,7 @@ in {
restic_jellyfin = restic + 9;
restic_grocy = restic + 10;
restic_lappy_t495 = restic + 11;
http_music = http + 0;
http_public = http + 1;
http_uploads_public = http + 2;

View file

@ -91,7 +91,7 @@ in {
"--vfs-cache-max-age=5m"
"--vfs-cache-max-size=1g"
"--vfs-cache-mode=full"
];
];
}
{
id = "notes";

View file

@ -45,10 +45,10 @@
"api-keys/data/storage/webdav/Uploads"
"api-keys/data/storage/webdav/Gaming"
"api-keys/data/storage/webdav/Notes"
"private-public-keys/data/rclone/Chaos-Media-Crypt"
"private-public-keys/data/rclone/Chaos-Gaming-Crypt"
"private-public-keys/data/rclone/Chaos-Notes-Crypt"
"private-public-keys/data/rclone/Chaos-Notes-Crypt"
];
packages = with pkgs; [
@ -245,7 +245,7 @@
simple_get_htpasswd "/api-keys/storage/webdav/Notes" "$secretFile"
'';
};
rclone_config = {
user = "storage";
group = "storage";

View file

@ -4,25 +4,26 @@
tree,
...
}: let
alsaDevice = "sysdefault:CARD=BTR3K";
pipewireDevice = "alsa_output.usb-FiiO_FiiO_BTR3K_ABCDEF0123456789-00.analog-stereo";
hardwareVolume = 75;
alsaDevice = "sysdefault:CARD=A";
alsaControl = "Headphone";
mpvDevice = "alsa/${alsaDevice}";
hardwareVolume = 80;
startMusicPlayer = pkgs.writeShellScriptBin "startMusicPlayer" ''
${pkgs.alsa-utils}/bin/amixer -D "${alsaDevice}" sset "${alsaControl}" "${toString hardwareVolume}%"
exec ${pkgs.mpv}/bin/mpv \
"https://music:$(cat /secrets/music_stream_password)@mpd.owo.monster/flac" \
--cache=yes --cache-pause-initial=yes --cache-pause-wait=5 \
--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" ''
set -x
export XDG_RUNTIME_DIR=/run/user/$UID
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
'';
@ -35,6 +36,7 @@ in {
environment.systemPackages = [startMusicPlayer startMusicPlayerSession];
users.users.music-player = {
uid = 1001;
isNormalUser = true;
linger = true;
extraGroups = [
@ -49,8 +51,6 @@ in {
programs.mpv.enable = true;
imports = with tree; [
home.base
home.apps.kitty
home.apps.pavucontrol
];
home.stateVersion = "23.05";
};
@ -63,10 +63,11 @@ in {
"plymouth-quit.service"
"systemd-logind.service"
"getty@tty1.service"
"user@1001.service"
"network.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"];
conflicts = ["getty@tty1.service"];
@ -77,8 +78,7 @@ in {
${pkgs.cage}/bin/cage -s ${startMusicPlayerSession}/bin/startMusicPlayerSession
'';
User = "music-player";
StandardOutput = "append:/var/log/music-player.log";
StandardError = "inherit";
StandardError = "append:/var/log/music-player.log";
IgnoreSIGPIPE = "no";
UtmpIdentifier = "%n";
UtmpMode = "user";
@ -109,6 +109,6 @@ in {
systemd.targets.music-player = {
description = "Music player";
wants = ["music-player.service" "networkmanager.service"];
wants = ["music-player.service" "networkmanager.service" "user@1001.service"];
};
}