From 287560e0fa608965b8ad474b7b185eac9156be75 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Mon, 18 Sep 2023 15:30:59 +0200 Subject: [PATCH] mpd: Add listenbrainz submitting --- modules/gui.nix | 7 +++++++ secrets.yaml | 5 +++-- users/simon/modules/mpd.nix | 20 ++++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/modules/gui.nix b/modules/gui.nix index 661e492..4585f61 100644 --- a/modules/gui.nix +++ b/modules/gui.nix @@ -45,4 +45,11 @@ lib.mkIf config.sbruder.gui.enable { } }); ''; + + sops.secrets = lib.mkIf config.sbruder.trusted { + listenbrainz-token = { + group = "users"; + mode = "440"; + }; + }; } diff --git a/secrets.yaml b/secrets.yaml index 18623f9..ea3ed8c 100644 --- a/secrets.yaml +++ b/secrets.yaml @@ -1,3 +1,4 @@ +listenbrainz-token: ENC[AES256_GCM,data:0lHG/52VGRnO+ubG2dZqILIgZ4ddSmZKN2AOhL3ezP0MbQw1,iv:fFvFOVy1oF1Ppv0PwyNDem6h5OqZLF/9DDrODHjg7g0=,tag:LwplKbzhz5rfCuY91WXk9w==,type:str] media-htpasswd: ENC[AES256_GCM,data:8o+MBYaH+OoPrK2FtDzxCLXCz8oGDezIALl2KkoVlj/ZtC4WfTHu6NnaUbi+xUb7s8bLHchpmFyXC9U5+yGAlHV/v7zKOrkrga08Qn2sHqudZS8uRMj4Mh/WdYbAJ+MjfhihTf377obIDJAesYwL8Jnkcy5NiVSD7jN7PJUlTLFLiXr+U+dYctJG1b2TnhNaGL9FnutG6GnOHP37AZaTMPaD0YgSNJ+PNEGULkajwxNj2dn9XFeQGa5DlETHh8UlL3+6hUBUgXsAiN3UkRYJGLybq2vDlS9uRXRzobCiqK1E58SXS0ZMOUzewtvvOixXDC31/ppd1WmUOweJ4JiAKGWindgj5yejxf8kk2UaIJQTjATb1jtQTmdMBEfckIq+xvbyVNAofBSlSAuo/FGNYt7zf2uH1Y6A3cQwgTSaMo8Rs01AfszyaXLMqwiS+k9kq/QXkH4VLAbVakli4yuywB4pusqBvf5vAFDdgTtKhag4vuworbo/kM8KXh6nAA==,iv:n44K6SEtrL6MYEzXdPHbOvzoIQBqnVee+uC0/kbgd1M=,tag:HeOX3bXb107fSFXUk6Hc5Q==,type:str] media-proxy-auth: ENC[AES256_GCM,data:OcmYZq/tyzMB61NfyYZ8gAlEE+8w2IhlPlZ+dfedtfqVlPHk3iJsd9mvsXHf5ODTtuy00ll0MF4KYNePZkz7TeuaIdBgGlshFyE4gwsJdPXZNYnhcg==,iv:qo6SOaHrWsXfvRwgSKDTSnreOcO9xy3RKrfE2k+VLEg=,tag:14DT86PQdEuK9zyZzcAohA==,type:str] media-ssh-key: ENC[AES256_GCM,data:cT5Jp5asgF2GZL4nn0rS4+tmli5adZjDa/G6WD/QXbOLtAjquytX63LKrLYUoTjOa7rNAjxDBIYEi90uvubKxOI0QbXACj0MSt6WbkxmosYResnFl9/WefpROctpGcDvn60fzer0K75IRBAtpAogVU7VynOkOuPa0xhTyAU8ZPOmij456UjpbtIgSg4yKVDn14jj/OZ1Oz+qd3bHC8FSQvp0jSKD9xfIizc2kb6ca3LRdR7VtJtTnJOOADRKaLC+rBywVyTOlCQBLiZ6LE9i6SmgFOdI+l6z9jE1Vi3vZ3BAe8Q/wWQ6Kjts+3+RkjPbgdjdWzxyHly/dr8lU1HcwtMHgKBV84asJBghCm6B1o48AEqd4oF9W039rCRQkR/VMb/ser0ifEjwnpDnDskrFYxWzidMKsfHGOtZxm7rzvOxSRA+Rcx9vxwa90gRsU4mBdx7QG0y3f/AbxRvVCuLLZW/y0JpCtE2B/mcObRvjsZP3RXQIS4vGAeTerd18RwsrsWO,iv:+ASa0hhWXmQ2hgJ9UuRFjnf/fA65kxWXiC+rDI6Lnx8=,tag:LDYSsN0DXAFiW0w+YBcopA==,type:str] @@ -10,8 +11,8 @@ sops: azure_kv: [] hc_vault: [] age: [] - lastmodified: "2022-08-25T14:27:39Z" - mac: ENC[AES256_GCM,data:75hpB3gQ5WhqdSG4q1w08dQ1g9QGK2PA3hqXHnRz7cosjAERyldIG9TmOATrUGLULUy+E8fnOaACCatY5aMXVL/wmn77GkI4EA658D9j3Fhm1+k/Tv+rE8+4icb+9YNVZijLpHzSlMKZVOdYyg+CZlAC/xDz6ggdZOO6Ks29N+Q=,iv:0NKHdZxKmcUNiraoBW4WldO2hHkaTDVH0sUk/lh1Xg8=,tag:mRfDetmVh0Nv/4nHjCs/5g==,type:str] + lastmodified: "2023-09-18T13:17:11Z" + mac: ENC[AES256_GCM,data:y6VTyAeZgGyqafjw7asaeEq2XhhhB8QW8qhnaqUNUCO+OsgITXMOGwQmsWKN7qnW8D8r5WHiR0aojGROBhSKJ1tgPjRu+Ya5rMsOIN5KecqBhA1Z7yOL45xcYKVNJmiL0p9fxrrBQi1FP1zE1Rgwx+nD6MfydLoEU9LDBRFcyUs=,iv:Q3jbtDU+zWZXGhtCu3qC7KCXOM7gRBePHN0CxqBpvAM=,tag:8iRP6j78H90aDujiQh33fw==,type:str] pgp: - created_at: "2023-05-06T07:18:02Z" enc: |- diff --git a/users/simon/modules/mpd.nix b/users/simon/modules/mpd.nix index 519680b..84272b3 100644 --- a/users/simon/modules/mpd.nix +++ b/users/simon/modules/mpd.nix @@ -73,6 +73,12 @@ lib.mkIf nixosConfig.sbruder.gui.enable { # Misc external_editor = "nvim"; }; + bindings = [ + # not really speaking bindings, though t(op), h(ate) and d(elete) are somewhat memorizable + { key = "t"; command = ''run_external_command "mpc sendmessage listenbrainz_feedback love"''; } + { key = "h"; command = ''run_external_command "mpc sendmessage listenbrainz_feedback hate"''; } + { key = "d"; command = ''run_external_command "mpc sendmessage listenbrainz_feedback clear"''; } + ]; }; home.packages = with pkgs; [ @@ -80,4 +86,18 @@ lib.mkIf nixosConfig.sbruder.gui.enable { ]; home.sessionVariables.MPD_HOST = config.services.mpd.network.listenAddress; + + services.listenbrainz-mpd = lib.mkIf nixosConfig.sbruder.trusted { + enable = true; + package = pkgs.unstable.listenbrainz-mpd; + settings = { + submission = { + token_file = "/run/secrets/listenbrainz-token"; + }; + + mpd = { + address = config.services.mpd.network.listenAddress; + }; + }; + }; }