From d336291ac963d2598c274da786a5cd442fc8d301 Mon Sep 17 00:00:00 2001 From: Madeleine Sydney Date: Thu, 2 Jan 2025 01:16:18 -0700 Subject: [PATCH] feat: MPD --- modules/home/mpd.nix | 79 +++++++++++++++++++++++++++++++++++++ users/crumb/default.nix | 27 ++++++------- users/crumb/files.nix | 20 ++++++++++ users/crumb/mpdscribble.nix | 15 +++++++ users/crumb/secrets.yaml | 7 ++-- 5 files changed, 131 insertions(+), 17 deletions(-) create mode 100644 modules/home/mpd.nix create mode 100644 users/crumb/mpdscribble.nix diff --git a/modules/home/mpd.nix b/modules/home/mpd.nix new file mode 100644 index 0000000..f6a1fa1 --- /dev/null +++ b/modules/home/mpd.nix @@ -0,0 +1,79 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let cfg = config.sydnix.mpd; +in { + options = { + sydnix.mpd = { + enable = mkEnableOption "Music Player Daemon"; + + musicDirectory = mkOption { + default = "${config.home.homeDirectory}/Music"; + type = types.path; + }; + + scrobbling = { + enable = mkOption { + description = "Enable scrobbling for MPD via mpdscribble."; + type = types.bool; + default = cfg.enable; + }; + + endpoints = mkOption { + type = types.attrsOf (types.submodule ({ ... }: { + options = { + passwordFile = mkOption { + type = types.path; + }; + username = mkOption { + type = types.str; + }; + }; + })); + }; + }; + + discord = { + enable = mkOption { + description = "Enable Discord integration for MPD via mpd-discord-rpc."; + type = types.bool; + default = cfg.enable; + }; + }; + }; + }; + + config = mkIf cfg.enable { + services.mpd = { + enable = true; + musicDirectory = cfg.musicDirectory; + extraConfig = '' + audio_output { + type "pipewire" + name "My PipeWire Output" + } + ''; + # if you want to allow non-localhost connections + network.listenAddress = "any"; + }; + + services.mpd-discord-rpc = mkIf cfg.discord.enable { + enable = true; + }; + + # services.mpdscribble = mkIf cfg.scrobbling.enable { + # enable = true; + # endpoints = { + # "last.fm" = { + # passwordFile = "/etc/insecure-bullshit/lastfm-password.lol"; + # username = "crumb1"; + # }; + # "libre.fm" = { + # passwordFile = "/etc/insecure-bullshit/librefm-password.lol"; + # username = "crumbtoo"; + # }; + # }; + # }; + }; +} diff --git a/users/crumb/default.nix b/users/crumb/default.nix index ab19864..b12ec05 100755 --- a/users/crumb/default.nix +++ b/users/crumb/default.nix @@ -19,24 +19,23 @@ enable = true; keyFile = "/persist/user-files/${config.home.username}/key.txt"; secrets = { - example-user-key = {}; + lastfm-password = {}; + librefm-password = {}; }; }; - impermanence = { + mpd = { enable = true; - directories = [ - "Music" - "Pictures" - "Documents" - "Videos" - ".ssh" - { - directory = ".local/share/Steam"; - method = "symlink"; - } - ".passage" - ]; + scrobbling.endpoints = { + "last.fm" = { + passwordFile = config.sydnix.sops.secrets.lastfm-password.path; + username = "crumb1"; + }; + "libre.fm" = { + passwordFile = config.sydnix.sops.secrets.librefm-password.path; + username = "crumbtoo"; + }; + }; }; }; diff --git a/users/crumb/files.nix b/users/crumb/files.nix index b9972ce..8f66201 100644 --- a/users/crumb/files.nix +++ b/users/crumb/files.nix @@ -4,4 +4,24 @@ let mutableSymlink = config.lib.file.mkOutOfStoreSymlink; in { home.file."org".source = mutableSymlink "~/Dropbox/org"; + + xdg.configFile."sops/age/keys.txt".source = + mutableSymlink "/persist/user-files/${config.home.username}/key.txt"; + + sydnix.impermanence = { + enable = true; + directories = [ + "Music" + "Pictures" + "Documents" + "Videos" + ".ssh" + { + directory = ".local/share/Steam"; + method = "symlink"; + } + ".passage" + ]; + }; + } diff --git a/users/crumb/mpdscribble.nix b/users/crumb/mpdscribble.nix new file mode 100644 index 0000000..24d808b --- /dev/null +++ b/users/crumb/mpdscribble.nix @@ -0,0 +1,15 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let cfg = config.services.mpdscribble; +in { + options = { + services.mpdscribble = { + enable = mkEnableOption "the mpdscribble service"; + }; + }; + + config = mkIf cfg.enable { + }; +} diff --git a/users/crumb/secrets.yaml b/users/crumb/secrets.yaml index 09fdfc7..39b022f 100755 --- a/users/crumb/secrets.yaml +++ b/users/crumb/secrets.yaml @@ -1,4 +1,5 @@ -example-user-key: ENC[AES256_GCM,data:zefLZFp/MuxwrhbNhiCRWOCG,iv:IFwI3e2+uq1yv+hWQnHcX25XGiHa3AFqeIr5LW+2KFo=,tag:yS6KzPK7robKJsupZW8a2w==,type:str] +lastfm-password: ENC[AES256_GCM,data:gLcWwEFLhlVdMWez5Kaja17WFUA=,iv:KT9JO0823dn6qHnK2uOacMxHf4f776/soXFUVjUi1UA=,tag:n77bHc97yoKJPYvTCWhEuQ==,type:str] +librefm-password: ENC[AES256_GCM,data:0gDlWC/2CxryI6jH5RuJ,iv:8QVnhLko3H/IupQrNknxTR8NewfTP+DJyzvHk9Hzr48=,tag:Ku02Jp7p5G5qkO41Y3EFwA==,type:str] sops: kms: [] gcp_kms: [] @@ -14,8 +15,8 @@ sops: VVBqSEM2bVFBU0M5YzZBQWIwUmVXUXMKvWb57Rc+rO5M8Pf7lvbSjuZB4FrHgT3A uBQHH3wpv0BVVzL8tucPnwNxDnwpWvFxxwNVy/rtfs6y6HPu6fuOsA== -----END AGE ENCRYPTED FILE----- - lastmodified: "2024-12-29T08:21:03Z" - mac: ENC[AES256_GCM,data:08lmfeXvrhipenfCO9AjdahGSvfaUO74EVlbtjhNw+Pjlu3SQNlqTBdzPFwpebCphNnryun/WGgT6fopgyITdkd1V7DGQLV184LRe0lD5qA3DEBm+uEPBqFpXT0AYucylWEam8paZYZ8HjdPL91I1H1MTDqGcO2dYhAh59JWXfE=,iv:fY+FxlfexYkkQsYp/On/QEhiKrZyzJ6mzTaXIxY44u0=,tag:U29ULu1vNi2z/MXMz9PkTg==,type:str] + lastmodified: "2025-01-02T08:53:07Z" + mac: ENC[AES256_GCM,data:MGK6/dU2DfpFS2YfX67JihtqOmHgIjdv3fK24VK5L5eooYN9EuOdOU7vqrS4F6SAbPLJ6S0/wamUnAsWZ9MID6DP1BEEVbMhzucyBAbMlQWWlC0p/eu/yW3XOlgto5MEXP6DwXTWHtgK4VKlQk+LmZpdtnm3cX1MH96WoNN9kyI=,iv:JksmtiYXeOe9/aMAc5JiCxdFtnpd8JpFEnGWEAH7gLg=,tag:7yH6rKA48pz2ECJ6L4T4sQ==,type:str] pgp: [] unencrypted_suffix: _unencrypted version: 3.9.1