mpc: 0.34 -> 0.35 (#347387)

Changed files
+292 -242
nixos
modules
services
hardware
tests
pkgs
applications
audio
window-managers
i3
bumblebee-status
by-name
cl
clerk
mp
top-level
+60 -34
nixos/modules/services/hardware/triggerhappy.nix
···
-
{ config, lib, pkgs, ... }:
+
{
+
config,
+
lib,
+
pkgs,
+
...
+
}:
let
cfg = config.services.triggerhappy;
···
socket = "/run/thd.socket";
configFile = pkgs.writeText "triggerhappy.conf" ''
-
${lib.concatMapStringsSep "\n"
-
({ keys, event, cmd, ... }:
-
''${lib.concatMapStringsSep "+" (x: "KEY_" + x) keys} ${toString { press = 1; hold = 2; release = 0; }.${event}} ${cmd}''
-
)
-
cfg.bindings}
+
${lib.concatMapStringsSep "\n" (
+
{
+
keys,
+
event,
+
cmd,
+
...
+
}:
+
''${lib.concatMapStringsSep "+" (x: "KEY_" + x) keys} ${
+
toString
+
{
+
press = 1;
+
hold = 2;
+
release = 0;
+
}
+
.${event}
+
} ${cmd}''
+
) cfg.bindings}
${cfg.extraConfig}
'';
-
bindingCfg = { ... }: {
-
options = {
+
bindingCfg =
+
{ ... }:
+
{
+
options = {
-
keys = lib.mkOption {
-
type = lib.types.listOf lib.types.str;
-
description = "List of keys to match. Key names as defined in linux/input-event-codes.h";
-
};
+
keys = lib.mkOption {
+
type = lib.types.listOf lib.types.str;
+
description = "List of keys to match. Key names as defined in linux/input-event-codes.h";
+
};
-
event = lib.mkOption {
-
type = lib.types.enum ["press" "hold" "release"];
-
default = "press";
-
description = "Event to match.";
-
};
+
event = lib.mkOption {
+
type = lib.types.enum [
+
"press"
+
"hold"
+
"release"
+
];
+
default = "press";
+
description = "Event to match.";
+
};
-
cmd = lib.mkOption {
-
type = lib.types.str;
-
description = "What to run.";
-
};
+
cmd = lib.mkOption {
+
type = lib.types.str;
+
description = "What to run.";
+
};
+
};
};
-
};
in
···
bindings = lib.mkOption {
type = lib.types.listOf (lib.types.submodule bindingCfg);
-
default = [];
+
default = [ ];
example = lib.literalExpression ''
-
[ { keys = ["PLAYPAUSE"]; cmd = "''${pkgs.mpc-cli}/bin/mpc -q toggle"; } ]
+
[ { keys = ["PLAYPAUSE"]; cmd = "''${lib.getExe pkgs.mpc} -q toggle"; } ]
'';
description = ''
Key bindings for {command}`triggerhappy`.
···
};
-
###### implementation
config = lib.mkIf cfg.enable {
···
wantedBy = [ "multi-user.target" ];
description = "Global hotkey daemon";
serviceConfig = {
-
ExecStart = "${pkgs.triggerhappy}/bin/thd ${lib.optionalString (cfg.user != "root") "--user ${cfg.user}"} --socket ${socket} --triggers ${configFile} --deviceglob /dev/input/event*";
+
ExecStart = "${pkgs.triggerhappy}/bin/thd ${
+
lib.optionalString (cfg.user != "root") "--user ${cfg.user}"
+
} --socket ${socket} --triggers ${configFile} --deviceglob /dev/input/event*";
};
};
-
services.udev.packages = lib.singleton (pkgs.writeTextFile {
-
name = "triggerhappy-udev-rules";
-
destination = "/etc/udev/rules.d/61-triggerhappy.rules";
-
text = ''
-
ACTION=="add", SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{name}!="triggerhappy", \
-
RUN+="${pkgs.triggerhappy}/bin/th-cmd --socket ${socket} --passfd --udev"
-
'';
-
});
+
services.udev.packages = lib.singleton (
+
pkgs.writeTextFile {
+
name = "triggerhappy-udev-rules";
+
destination = "/etc/udev/rules.d/61-triggerhappy.rules";
+
text = ''
+
ACTION=="add", SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{name}!="triggerhappy", \
+
RUN+="${pkgs.triggerhappy}/bin/th-cmd --socket ${socket} --passfd --udev"
+
'';
+
}
+
);
};
+72 -55
nixos/tests/mpd.nix
···
-
import ./make-test-python.nix ({ pkgs, lib, ... }:
+
import ./make-test-python.nix (
+
{ pkgs, lib, ... }:
let
track = pkgs.fetchurl {
# Sourced from http://freemusicarchive.org/music/Blue_Wave_Theory/Surf_Music_Month_Challenge/Skyhawk_Beach_fade_in
-
# License: http://creativecommons.org/licenses/by-sa/4.0/
name = "Blue_Wave_Theory-Skyhawk_Beach.mp3";
url = "https://freemusicarchive.org/file/music/ccCommunity/Blue_Wave_Theory/Surf_Music_Month_Challenge/Blue_Wave_Theory_-_04_-_Skyhawk_Beach.mp3";
-
sha256 = "0xw417bxkx4gqqy139bb21yldi37xx8xjfxrwaqa0gyw19dl6mgp";
+
hash = "sha256-91VDWwrcP6Cw4rk72VHvZ8RGfRBrpRE8xo/02dcJhHc=";
+
meta.license = lib.licenses.cc-by-sa-40;
};
defaultCfg = rec {
···
musicDirectory = "${dataDir}/music";
};
-
defaultMpdCfg = with defaultCfg; {
-
inherit dataDir musicDirectory user group;
+
defaultMpdCfg = {
+
inherit (defaultCfg)
+
dataDir
+
musicDirectory
+
user
+
group
+
;
enable = true;
};
-
musicService = { user, group, musicDirectory }: {
-
description = "Sets up the music file(s) for MPD to use.";
-
requires = [ "mpd.service" ];
-
after = [ "mpd.service" ];
-
wantedBy = [ "default.target" ];
-
script = ''
-
cp ${track} ${musicDirectory}
-
'';
-
serviceConfig = {
-
User = user;
-
Group = group;
+
musicService =
+
{
+
user,
+
group,
+
musicDirectory,
+
}:
+
{
+
description = "Sets up the music file(s) for MPD to use.";
+
requires = [ "mpd.service" ];
+
after = [ "mpd.service" ];
+
wantedBy = [ "default.target" ];
+
script = ''
+
cp ${track} ${musicDirectory}
+
'';
+
serviceConfig = {
+
User = user;
+
Group = group;
+
};
};
-
};
-
mkServer = { mpd, musicService, }:
-
{ boot.kernelModules = [ "snd-dummy" ];
+
mkServer =
+
{ mpd, musicService }:
+
{
+
boot.kernelModules = [ "snd-dummy" ];
services.mpd = mpd;
systemd.services.musicService = musicService;
};
-
in {
+
in
+
{
name = "mpd";
-
meta = with pkgs.lib.maintainers; {
-
maintainers = [ emmanuelrosa ];
+
meta = {
+
maintainers = with lib.maintainers; [ emmanuelrosa ];
};
-
nodes =
-
{ client =
-
{ ... }: { };
+
nodes = {
+
client = { ... }: { };
serverALSA =
-
{ ... }: lib.mkMerge [
+
{ ... }:
+
lib.mkMerge [
(mkServer {
mpd = defaultMpdCfg // {
network.listenAddress = "any";
···
}
'';
};
-
musicService = with defaultMpdCfg; musicService { inherit user group musicDirectory; };
+
musicService = musicService { inherit (defaultMpdCfg) user group musicDirectory; };
})
{ networking.firewall.allowedTCPPorts = [ 6600 ]; }
];
serverPulseAudio =
-
{ ... }: lib.mkMerge [
+
{ ... }:
+
lib.mkMerge [
(mkServer {
mpd = defaultMpdCfg // {
extraConfig = ''
···
'';
};
-
musicService = with defaultCfg; musicService { inherit user group musicDirectory; };
+
musicService = musicService { inherit (defaultMpdCfg) user group musicDirectory; };
})
{
hardware.pulseaudio = {
···
];
};
-
testScript = ''
-
mpc = "${pkgs.mpc-cli}/bin/mpc --wait"
+
testScript = ''
+
mpc = "${lib.getExe pkgs.mpc} --wait"
-
# Connects to the given server and attempts to play a tune.
-
def play_some_music(server):
-
server.wait_for_unit("mpd.service")
-
server.succeed(f"{mpc} update")
-
_, tracks = server.execute(f"{mpc} ls")
+
# Connects to the given server and attempts to play a tune.
+
def play_some_music(server):
+
server.wait_for_unit("mpd.service")
+
server.succeed(f"{mpc} update")
+
_, tracks = server.execute(f"{mpc} ls")
-
for track in tracks.splitlines():
-
server.succeed(f"{mpc} add {track}")
+
for track in tracks.splitlines():
+
server.succeed(f"{mpc} add {track}")
-
_, added_tracks = server.execute(f"{mpc} playlist")
+
_, added_tracks = server.execute(f"{mpc} playlist")
-
# Check we succeeded adding audio tracks to the playlist
-
assert len(added_tracks.splitlines()) > 0
+
# Check we succeeded adding audio tracks to the playlist
+
assert len(added_tracks.splitlines()) > 0
-
server.succeed(f"{mpc} play")
+
server.succeed(f"{mpc} play")
-
_, output = server.execute(f"{mpc} status")
-
# Assure audio track is playing
-
assert "playing" in output
+
_, output = server.execute(f"{mpc} status")
+
# Assure audio track is playing
+
assert "playing" in output
-
server.succeed(f"{mpc} stop")
+
server.succeed(f"{mpc} stop")
-
play_some_music(serverALSA)
-
play_some_music(serverPulseAudio)
+
play_some_music(serverALSA)
+
play_some_music(serverPulseAudio)
-
client.wait_for_unit("multi-user.target")
-
client.succeed(f"{mpc} -h serverALSA status")
+
client.wait_for_unit("multi-user.target")
+
client.succeed(f"{mpc} -h serverALSA status")
-
# The PulseAudio-based server is configured not to accept external client connections
-
# to perform the following test:
-
client.fail(f"{mpc} -h serverPulseAudio status")
-
'';
-
})
+
# The PulseAudio-based server is configured not to accept external client connections
+
# to perform the following test:
+
client.fail(f"{mpc} -h serverPulseAudio status")
+
'';
+
}
+
)
-82
pkgs/applications/audio/clerk/default.nix
···
-
{ lib
-
, stdenv
-
, fetchFromGitHub
-
, makeWrapper
-
, rofi
-
, tmux
-
, fzf
-
, mpc-cli
-
, perl
-
, util-linux
-
, libnotify
-
, perlPackages
-
}:
-
-
stdenv.mkDerivation {
-
pname = "clerk";
-
version = "unstable-2023-10-07";
-
-
src = fetchFromGitHub {
-
owner = "carnager";
-
repo = "clerk";
-
rev = "907138d8fc2b1709fb49d062d0b663a48eb210bd";
-
hash = "sha256-V2nDLq2ViC5Twve0EILBEYOdEavqgYB/TQq/T+ftfmk=";
-
};
-
-
postPatch = ''
-
substituteInPlace clerk_rating_client.service \
-
--replace "/usr" "$out"
-
'';
-
-
nativeBuildInputs = [ makeWrapper ];
-
-
buildInputs = with perlPackages; [
-
perl
-
DataMessagePack
-
DataSectionSimple
-
ConfigSimple
-
TryTiny
-
IPCRun
-
HTTPDate
-
FileSlurper
-
ArrayUtils
-
NetMPD
-
];
-
-
dontBuild = true;
-
-
strictDeps = true;
-
-
installPhase = ''
-
runHook preInstall
-
-
install -D clerk.pl $out/bin/clerk
-
install -D clerk_rating_client $out/bin/clerk_rating_client
-
install -D clerk_rating_client.service $out/lib/systemd/user/clerk_rating_client.service
-
runHook postInstall
-
'';
-
-
postFixup = let
-
binPath = lib.makeBinPath [
-
libnotify
-
mpc-cli
-
rofi
-
tmux
-
fzf
-
util-linux
-
];
-
in
-
''
-
wrapProgram $out/bin/clerk --set PERL5LIB $PERL5LIB --prefix PATH : "${binPath}"
-
wrapProgram $out/bin/clerk_rating_client --set PERL5LIB $PERL5LIB --prefix PATH : "${binPath}"
-
'';
-
-
meta = with lib; {
-
description = "MPD client based on rofi/fzf";
-
homepage = "https://github.com/carnager/clerk";
-
license = licenses.mit;
-
maintainers = with maintainers; [ anderspapitto rewine ];
-
mainProgram = "clerk";
-
platforms = platforms.linux;
-
};
-
}
-63
pkgs/applications/audio/mpc/default.nix
···
-
{ lib
-
, stdenv
-
, fetchFromGitHub
-
, fetchpatch
-
, installShellFiles
-
, libiconv
-
, libmpdclient
-
, meson
-
, ninja
-
, pkg-config
-
, sphinx
-
}:
-
-
stdenv.mkDerivation rec {
-
pname = "mpc";
-
version = "0.34";
-
-
src = fetchFromGitHub {
-
owner = "MusicPlayerDaemon";
-
repo = pname;
-
rev = "v${version}";
-
hash = "sha256-2FjYBfak0IjibuU+CNQ0y9Ei8hTZhynS/BK2DNerhVw=";
-
};
-
-
patches = [
-
# fix the build with meson 0.60 (https://github.com/MusicPlayerDaemon/mpc/pull/76)
-
(fetchpatch {
-
url = "https://github.com/MusicPlayerDaemon/mpc/commit/b656ca4b6c2a0d5b6cebd7f7daa679352f664e0e.patch";
-
sha256 = "sha256-fjjSlCKxgkz7Em08CaK7+JAzl8YTzLcpGGMz2HJlsVw=";
-
})
-
];
-
-
buildInputs = [
-
libmpdclient
-
]
-
++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];
-
-
nativeBuildInputs = [
-
installShellFiles
-
meson
-
ninja
-
pkg-config
-
sphinx
-
];
-
-
postInstall = ''
-
installShellCompletion --cmd mpc --bash $out/share/doc/mpc/contrib/mpc-completion.bash
-
'';
-
-
postFixup = ''
-
rm $out/share/doc/mpc/contrib/mpc-completion.bash
-
'';
-
-
meta = with lib; {
-
homepage = "https://www.musicpd.org/clients/mpc/";
-
description = "Minimalist command line interface to MPD";
-
changelog = "https://raw.githubusercontent.com/MusicPlayerDaemon/mpc/v${version}/NEWS";
-
license = licenses.gpl2Plus;
-
maintainers = with maintainers; [ AndersonTorres ];
-
platforms = with platforms; unix;
-
mainProgram = "mpc";
-
};
-
}
+1 -1
pkgs/applications/window-managers/i3/bumblebee-status/plugins.nix
···
memory.propagatedBuildInputs = [ pkgs.gnome-system-monitor ];
messagereceiver = { };
mocp.propagatedBuildInputs = [ pkgs.moc ];
-
mpd.propagatedBuildInputs = [ pkgs.mpc-cli ];
+
mpd.propagatedBuildInputs = [ pkgs.mpc ];
network.propagatedBuildInputs = [ py.netifaces pkgs.iw ];
network_traffic.propagatedBuildInputs = [ py.netifaces ];
nic.propagatedBuildInputs = [ py.netifaces pkgs.iw ];
+103
pkgs/by-name/cl/clerk/package.nix
···
+
{
+
lib,
+
fetchFromGitHub,
+
fzf,
+
installShellFiles,
+
libnotify,
+
makeWrapper,
+
mpc,
+
perlPackages,
+
rofi,
+
stdenv,
+
tmux,
+
unstableGitUpdater,
+
util-linux,
+
}:
+
+
stdenv.mkDerivation {
+
pname = "clerk";
+
version = "4.0.5-unstable-2023-10-07";
+
+
src = fetchFromGitHub {
+
owner = "carnager";
+
repo = "clerk";
+
rev = "907138d8fc2b1709fb49d062d0b663a48eb210bd";
+
hash = "sha256-V2nDLq2ViC5Twve0EILBEYOdEavqgYB/TQq/T+ftfmk=";
+
};
+
+
nativeBuildInputs = [
+
installShellFiles
+
makeWrapper
+
];
+
+
buildInputs = with perlPackages; [
+
perl
+
DataMessagePack
+
DataSectionSimple
+
ConfigSimple
+
TryTiny
+
IPCRun
+
HTTPDate
+
FileSlurper
+
ArrayUtils
+
NetMPD
+
];
+
+
dontBuild = true;
+
+
strictDeps = true;
+
+
postPatch = ''
+
substituteInPlace clerk_rating_client.service \
+
--replace "/usr" "$out"
+
'';
+
+
installPhase = ''
+
runHook preInstall
+
+
mv clerk.pl clerk
+
installBin clerk clerk_rating_client
+
install -D clerk_rating_client.service $out/lib/systemd/user/clerk_rating_client.service
+
+
runHook postInstall
+
'';
+
+
postFixup =
+
let
+
binPath = lib.makeBinPath [
+
fzf
+
libnotify
+
mpc
+
rofi
+
tmux
+
util-linux
+
];
+
in
+
''
+
pushd $out/bin
+
for f in clerk clerk_rating_client; do
+
wrapProgram $f \
+
--prefix PATH : "${binPath}" \
+
--set PERL5LIB $PERL5LIB
+
done
+
popd
+
'';
+
+
passthru.updateScript = unstableGitUpdater {
+
url = "https://github.com/carnager/clerk.git";
+
hardcodeZeroVersion = true;
+
};
+
+
meta = {
+
homepage = "https://github.com/carnager/clerk";
+
description = "MPD client based on rofi/fzf";
+
license = lib.licenses.mit;
+
mainProgram = "clerk";
+
maintainers = with lib.maintainers; [
+
anderspapitto
+
rewine
+
AndersonTorres
+
];
+
platforms = lib.platforms.linux;
+
};
+
}
+54
pkgs/by-name/mp/mpc/package.nix
···
+
{
+
lib,
+
fetchFromGitHub,
+
installShellFiles,
+
libiconv,
+
libmpdclient,
+
meson,
+
ninja,
+
pkg-config,
+
python3Packages,
+
stdenv,
+
}:
+
+
stdenv.mkDerivation (finalAttrs: {
+
pname = "mpc";
+
version = "0.35";
+
+
src = fetchFromGitHub {
+
owner = "MusicPlayerDaemon";
+
repo = "mpc";
+
rev = "v${finalAttrs.version}";
+
hash = "sha256-oVdnj3nsYvOHcIOgoamLamriuWu9lucWUQtxVmXZabs=";
+
};
+
+
buildInputs = [
+
libmpdclient
+
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];
+
+
nativeBuildInputs = [
+
installShellFiles
+
meson
+
ninja
+
pkg-config
+
python3Packages.sphinx
+
];
+
+
postInstall = ''
+
installShellCompletion --cmd mpc --bash $out/share/doc/mpc/contrib/mpc-completion.bash
+
'';
+
+
postFixup = ''
+
rm $out/share/doc/mpc/contrib/mpc-completion.bash
+
'';
+
+
meta = {
+
homepage = "https://www.musicpd.org/clients/mpc/";
+
description = "Minimalist command line interface to MPD";
+
changelog = "https://raw.githubusercontent.com/MusicPlayerDaemon/mpc/refs/heads/master/NEWS";
+
license = lib.licenses.gpl2Plus;
+
mainProgram = "mpc";
+
maintainers = with lib.maintainers; [ AndersonTorres ];
+
platforms = lib.platforms.unix;
+
};
+
})
+2 -1
pkgs/top-level/aliases.nix
···
mongodb-5_0 = throw "mongodb-5_0 has been removed, it's end of life since October 2024"; # Added 2024-10-01
moz-phab = mozphab; # Added 2022-08-09
mp3info = throw "'mp3info' has been removed due to lack of maintenance upstream. Consider using 'eartag' or 'tagger' instead"; # Added 2024-09-14
-
mpc_cli = mpc-cli; # moved from top-level 2022-01-24
+
mpc-cli = mpc; # Added 2024-10-14
+
mpc_cli = mpc; # Added 2024-10-14
mpd_clientlib = throw "'mpd_clientlib' has been renamed to/replaced by 'libmpdclient'"; # Converted to throw 2024-10-17
mpdevil = plattenalbum; # Added 2024-05-22
mpg321 = throw "'mpg321' has been removed due to it being unmaintained by upstream. Consider using mpg123 instead."; # Added 2024-05-10
-6
pkgs/top-level/all-packages.nix
···
withConplay = false;
-
mpc-cli = callPackage ../applications/audio/mpc {
-
inherit (python3Packages) sphinx;
-
};
-
-
clerk = callPackage ../applications/audio/clerk { };
-
nbstripout = callPackage ../applications/version-management/nbstripout { };
ncmpc = callPackage ../applications/audio/ncmpc { };