Unverified Commit c71cae8b authored by Sefa Eyeoglu's avatar Sefa Eyeoglu Committed by GitHub
Browse files

mpc: 0.34 -> 0.35 (#347387)

parents 2d6cb731 913fb634
Loading
Loading
Loading
Loading
+62 −36
Original line number Diff line number Diff line
{ config, lib, pkgs, ... }:
{
  config,
  lib,
  pkgs,
  ...
}:
let

  cfg = config.services.triggerhappy;
@@ -6,15 +11,29 @@ let
  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 = { ... }: {
  bindingCfg =
    { ... }:
    {
      options = {

        keys = lib.mkOption {
@@ -23,7 +42,11 @@ let
        };

        event = lib.mkOption {
        type = lib.types.enum ["press" "hold" "release"];
          type = lib.types.enum [
            "press"
            "hold"
            "release"
          ];
          default = "press";
          description = "Event to match.";
        };
@@ -67,7 +90,7 @@ in
        type = lib.types.listOf (lib.types.submodule bindingCfg);
        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`.
@@ -86,7 +109,6 @@ in

  };


  ###### implementation

  config = lib.mkIf cfg.enable {
@@ -101,18 +123,22 @@ in
      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 {
    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
Original line number Diff line number Diff line
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 {
@@ -16,12 +17,23 @@ import ./make-test-python.nix ({ pkgs, lib, ... }:
      musicDirectory = "${dataDir}/music";
    };

    defaultMpdCfg = with defaultCfg; {
      inherit dataDir musicDirectory user group;
    defaultMpdCfg = {
      inherit (defaultCfg)
        dataDir
        musicDirectory
        user
        group
        ;
      enable = true;
    };

    musicService = { user, group, musicDirectory }: {
    musicService =
      {
        user,
        group,
        musicDirectory,
      }:
      {
        description = "Sets up the music file(s) for MPD to use.";
        requires = [ "mpd.service" ];
        after = [ "mpd.service" ];
@@ -35,23 +47,26 @@ import ./make-test-python.nix ({ pkgs, lib, ... }:
        };
      };

    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";
@@ -63,13 +78,14 @@ import ./make-test-python.nix ({ pkgs, lib, ... }:
                }
              '';
            };
            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 = ''
@@ -80,7 +96,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }:
              '';
            };

            musicService = with defaultCfg; musicService { inherit user group musicDirectory; };
            musicService = musicService { inherit (defaultMpdCfg) user group musicDirectory; };
          })
          {
            hardware.pulseaudio = {
@@ -95,7 +111,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }:
    };

    testScript = ''
    mpc = "${pkgs.mpc-cli}/bin/mpc --wait"
      mpc = "${lib.getExe pkgs.mpc} --wait"

      # Connects to the given server and attempts to play a tune.
      def play_some_music(server):
@@ -130,4 +146,5 @@ import ./make-test-python.nix ({ pkgs, lib, ... }:
      # to perform the following test:
      client.fail(f"{mpc} -h serverPulseAudio status")
    '';
})
  }
)
+1 −1
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ in
  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 −0
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchFromGitHub
, makeWrapper
, rofi
, tmux
, fzf
, mpc-cli
, perl
, util-linux
, libnotify
, perlPackages
{
  lib,
  fetchFromGitHub,
  fzf,
  installShellFiles,
  libnotify,
  makeWrapper,
  mpc,
  perlPackages,
  rofi,
  stdenv,
  tmux,
  unstableGitUpdater,
  util-linux,
}:

stdenv.mkDerivation {
  pname = "clerk";
  version = "unstable-2023-10-07";
  version = "4.0.5-unstable-2023-10-07";

  src = fetchFromGitHub {
    owner = "carnager";
@@ -23,12 +25,10 @@ stdenv.mkDerivation {
    hash = "sha256-V2nDLq2ViC5Twve0EILBEYOdEavqgYB/TQq/T+ftfmk=";
  };

  postPatch = ''
    substituteInPlace clerk_rating_client.service \
      --replace "/usr" "$out"
  '';

  nativeBuildInputs = [ makeWrapper ];
  nativeBuildInputs = [
    installShellFiles
    makeWrapper
  ];

  buildInputs = with perlPackages; [
    perl
@@ -47,36 +47,57 @@ stdenv.mkDerivation {

  strictDeps = true;

  postPatch = ''
    substituteInPlace clerk_rating_client.service \
      --replace "/usr" "$out"
  '';

  installPhase = ''
    runHook preInstall

    install -D clerk.pl $out/bin/clerk
    install -D clerk_rating_client $out/bin/clerk_rating_client
    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
  postFixup =
    let
      binPath = lib.makeBinPath [
        fzf
        libnotify
      mpc-cli
        mpc
        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}"
      pushd $out/bin
      for f in clerk clerk_rating_client; do
        wrapProgram $f \
          --prefix PATH : "${binPath}" \
          --set PERL5LIB $PERL5LIB
      done
      popd
    '';

  meta = with lib; {
    description = "MPD client based on rofi/fzf";
  passthru.updateScript = unstableGitUpdater {
    url = "https://github.com/carnager/clerk.git";
    hardcodeZeroVersion = true;
  };

  meta = {
    homepage = "https://github.com/carnager/clerk";
    license = licenses.mit;
    maintainers = with maintainers; [ anderspapitto rewine ];
    description = "MPD client based on rofi/fzf";
    license = lib.licenses.mit;
    mainProgram = "clerk";
    platforms = platforms.linux;
    maintainers = with lib.maintainers; [
      anderspapitto
      rewine
      AndersonTorres
    ];
    platforms = lib.platforms.linux;
  };
}
+54 −0
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, installShellFiles
, libiconv
, libmpdclient
, meson
, ninja
, pkg-config
, sphinx
{
  lib,
  fetchFromGitHub,
  installShellFiles,
  libiconv,
  libmpdclient,
  meson,
  ninja,
  pkg-config,
  python3Packages,
  stdenv,
}:

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "mpc";
  version = "0.34";
  version = "0.35";

  src = fetchFromGitHub {
    owner = "MusicPlayerDaemon";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-2FjYBfak0IjibuU+CNQ0y9Ei8hTZhynS/BK2DNerhVw=";
    repo = "mpc";
    rev = "v${finalAttrs.version}";
    hash = "sha256-oVdnj3nsYvOHcIOgoamLamriuWu9lucWUQtxVmXZabs=";
  };

  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 ];
  ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];

  nativeBuildInputs = [
    installShellFiles
    meson
    ninja
    pkg-config
    sphinx
    python3Packages.sphinx
  ];

  postInstall = ''
@@ -51,13 +42,13 @@ stdenv.mkDerivation rec {
    rm $out/share/doc/mpc/contrib/mpc-completion.bash
  '';

  meta = with lib; {
  meta = {
    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;
    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;
  };
}
})
Loading