1
0
Fork 0

Tune mpds

This commit is contained in:
Malte 2023-04-26 22:30:49 +02:00
parent 1e42d00b89
commit c68724e037
4 changed files with 42 additions and 30 deletions

View file

@ -230,23 +230,19 @@
},
"home-manager": {
"inputs": {
"nixpkgs": [],
"utils": [
"pre-commit-hooks",
"flake-utils"
]
"nixpkgs": []
},
"locked": {
"lastModified": 1681092193,
"narHash": "sha256-JerCqqOqbT2tBnXQW4EqwFl0hHnuZp21rIQ6lu/N4rI=",
"lastModified": 1682535786,
"narHash": "sha256-NH2a8yB8V25cglvcHDrvaTLvohzMgGLLZ4vnXQn4vOw=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "f9edbedaf015013eb35f8caacbe0c9666bbc16af",
"rev": "d82c9af8175878a461a0fdf914e67cc446664570",
"type": "github"
},
"original": {
"id": "home-manager",
"ref": "release-22.11",
"ref": "master",
"type": "indirect"
}
},

View file

@ -35,9 +35,8 @@
url = "git+https://gitlab.com/simple-nixos-mailserver/nixos-mailserver.git";
};
home-manager = {
url = "home-manager/release-22.11";
url = "home-manager/master";
inputs = {
utils.follows = "pre-commit-hooks/flake-utils";
nixpkgs.follows = "";
};
};

View file

@ -54,22 +54,29 @@ in [
];
}
{
Sound = {
"Play/Pause" = "${pkgs.playerctl}/bin/playerctl play-pause";
MPD = "ncmpcpp";
"Lautstärke" = "ncpamixer";
Pavucontrol = fork "pavucontrol";
Headset = {
Earplugs = {
connect = "bluetoothctl connect 00:00:AB:BD:7D:68";
disconnect = "bluetoothctl disconnect 00:00:AB:BD:7D:68";
Sound = let
mpdclient = host: "sh -c 'switch-mpd ${host}; ncmpcpp -h ${host}'";
in [
{"Play/Pause" = "${pkgs.playerctl}/bin/playerctl play-pause";}
{"MPD lokal" = mpdclient "::";}
{"Lautstärke" = "ncpamixer";}
{Pavucontrol = fork "pavucontrol";}
{
Headset = {
Earplugs = {
connect = "bluetoothctl connect 00:00:AB:BD:7D:68";
disconnect = "bluetoothctl disconnect 00:00:AB:BD:7D:68";
};
Overears = {
connect = "bluetoothctl connect E8:EE:CC:25:66:C3";
disconnect = "bluetoothctl disconnect E8:EE:CC:25:66:C3";
};
};
Overears = {
connect = "bluetoothctl connect E8:EE:CC:25:66:C3";
disconnect = "bluetoothctl disconnect E8:EE:CC:25:66:C3";
};
};
};
}
{"MPD Lounge" = mpdclient "lounge.w17.io";}
{"MPD Kitchen" = mpdclient "kitchen.w17.io";}
{"MPD Space" = mpdclient "burbon.w17.io";}
];
}
{
Apps = {
@ -132,9 +139,6 @@ in [
{"Monitor (btop)" = "btop";}
{
"W17" = {
"MPD Whisky" = "ncmpcpp -h whisky.w17.io";
"MPD Burbon" = "ncmpcpp -h burbon.w17.io";
"MPD Kitchen" = "ncmpcpp -h kitchen.w17.io";
Strichliste = "firefox https://strichliste.w17.io/#!/user/56";
Hub = "firefox https://hub.w17.io";
Summer = "ssh door@burbon.w17.io buzzer";

View file

@ -6,6 +6,8 @@
}: let
audio_dir = "${config.home.homeDirectory}/media/audio";
playlist_dir = "${audio_dir}/playlists";
mprisCfg = config.xdg.configFile."mpDris2/mpDris2.conf";
replace_string = "@HOST@";
in {
home.file."media/audio/playlists" = {
source = pkgs.recursiveLinkFarm "mpd-playlists" (lib.mapAttrs' (name: content: lib.nameValuePair "${name}.m3u" (builtins.toFile "${name}.m3u" content)) {
@ -19,6 +21,7 @@ in {
});
recursive = true;
};
xdg.configFile."mpDris2/mpDris2.conf".enable = false;
services = {
mpd = {
enable = true;
@ -32,6 +35,16 @@ in {
}
'';
};
mpdris2.enable = true;
mpdris2 = {
enable = true;
mpd.host = replace_string;
};
};
home.packages = [
(pkgs.writeShellScriptBin "switch-mpd" ''
mkdir -p ${config.xdg.configHome}/mpDris2
${lib.getExe pkgs.sd} -p ${replace_string} "$1" ${mprisCfg.source} > $HOME/${mprisCfg.target}
${pkgs.systemd}/bin/systemctl --user restart mpdris2.service
'')
];
}