X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fprivate%2Fmpd.nix;h=640b0015f6078fc47fbf152abf005358c73f59f2;hb=5315b439af1f72c3282549508ae58d86d66e38ec;hp=b2241651921d93c36524b0d566a33dbadfae7683;hpb=6a8252b11bb02f3e67857d5a9d733b1affa6a625;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/modules/private/mpd.nix b/modules/private/mpd.nix index b224165..640b001 100644 --- a/modules/private/mpd.nix +++ b/modules/private/mpd.nix @@ -1,39 +1,35 @@ -{ lib, pkgs, config, myconfig, ... }: +{ lib, pkgs, config, ... }: { - config = { - services.backup.profiles.mpd = { - rootDir = "/var/lib/mpd"; - }; - secrets.keys = [ - { - dest = "mpd"; + options.myServices.mpd.enable = lib.mkEnableOption "enable MPD"; + config = lib.mkIf config.myServices.mpd.enable { + secrets.keys = { + "mpd" = { permissions = "0400"; - text = myconfig.env.mpd.password; - } - { - dest = "mpd-config"; + text = config.myEnv.mpd.password; + }; + "mpd-config" = { permissions = "0400"; user = "mpd"; group = "mpd"; text = '' - password "${myconfig.env.mpd.password}@read,add,control,admin" + password "${config.myEnv.mpd.password}@read,add,control,admin" ''; - } - ]; + }; + }; networking.firewall.allowedTCPPorts = [ 6600 ]; users.users.mpd.extraGroups = [ "wwwrun" "keys" ]; systemd.services.mpd.serviceConfig.RuntimeDirectory = "mpd"; services.filesWatcher.mpd = { restart = true; - paths = [ "/var/secrets/mpd-config" ]; + paths = [ config.secrets.fullPaths."mpd-config" ]; }; services.mpd = { enable = true; network.listenAddress = "any"; - musicDirectory = myconfig.env.mpd.folder; + musicDirectory = config.myEnv.mpd.folder; extraConfig = '' - include "/var/secrets/mpd-config" + include "${config.secrets.fullPaths."mpd-config"}" audio_output { type "null" name "No Output"