1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-26 21:19:45 +01:00

mpd: add extraArgs (#3735)

Allow passing arguments to the MPD command line. Currently the only
interesting one is `--verbose`.
This commit is contained in:
Naïm Favier 2023-03-05 09:41:34 +01:00 committed by GitHub
parent b9e3a29864
commit 3c18113bd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 4 deletions

View file

@ -92,6 +92,15 @@ in {
''; '';
}; };
extraArgs = mkOption {
type = types.listOf types.str;
default = [ ];
example = [ "--verbose" ];
description = ''
Extra command-line arguments to pass to MPD.
'';
};
dataDir = mkOption { dataDir = mkOption {
type = types.path; type = types.path;
default = "${config.xdg.dataHome}/${name}"; default = "${config.xdg.dataHome}/${name}";
@ -176,7 +185,9 @@ in {
Service = { Service = {
Environment = "PATH=${config.home.profileDirectory}/bin"; Environment = "PATH=${config.home.profileDirectory}/bin";
ExecStart = "${cfg.package}/bin/mpd --no-daemon ${mpdConf}"; ExecStart = "${cfg.package}/bin/mpd --no-daemon ${mpdConf} ${
escapeShellArgs cfg.extraArgs
}";
Type = "notify"; Type = "notify";
ExecStartPre = '' ExecStartPre = ''
${pkgs.bash}/bin/bash -c "${pkgs.coreutils}/bin/mkdir -p '${cfg.dataDir}' '${cfg.playlistDirectory}'"''; ${pkgs.bash}/bin/bash -c "${pkgs.coreutils}/bin/mkdir -p '${cfg.dataDir}' '${cfg.playlistDirectory}'"'';

View file

@ -6,6 +6,7 @@ with lib;
services.mpd = { services.mpd = {
enable = true; enable = true;
musicDirectory = "/my/music/dir"; musicDirectory = "/my/music/dir";
extraArgs = [ "--verbose" ];
}; };
home.stateVersion = "22.11"; home.stateVersion = "22.11";

View file

@ -3,7 +3,7 @@ WantedBy=default.target
[Service] [Service]
Environment=PATH=/home/hm-user/.nix-profile/bin Environment=PATH=/home/hm-user/.nix-profile/bin
ExecStart=@mpd@/bin/mpd --no-daemon /nix/store/00000000000000000000000000000000-mpd.conf ExecStart=@mpd@/bin/mpd --no-daemon /nix/store/00000000000000000000000000000000-mpd.conf '--verbose'
ExecStartPre=/nix/store/00000000000000000000000000000000-bash/bin/bash -c "/nix/store/00000000000000000000000000000000-coreutils/bin/mkdir -p '/home/hm-user/.local/share/mpd' '/home/hm-user/.local/share/mpd/playlists'" ExecStartPre=/nix/store/00000000000000000000000000000000-bash/bin/bash -c "/nix/store/00000000000000000000000000000000-coreutils/bin/mkdir -p '/home/hm-user/.local/share/mpd' '/home/hm-user/.local/share/mpd/playlists'"
Type=notify Type=notify

View file

@ -3,7 +3,10 @@
with lib; with lib;
{ {
services.mpd.enable = true; services.mpd = {
enable = true;
extraArgs = [ "--verbose" ];
};
home.stateVersion = "18.09"; home.stateVersion = "18.09";

View file

@ -3,7 +3,11 @@
with lib; with lib;
{ {
services.mpd.enable = true; services.mpd = {
enable = true;
extraArgs = [ "--verbose" ];
};
xdg.userDirs.enable = true; xdg.userDirs.enable = true;
home.stateVersion = "22.11"; home.stateVersion = "22.11";