{
  pkgs,
  lib,
  config,
  ...
}: let
  cfg = config.desktop.pipewire;
in {
  options.desktop.pipewire = {
    enable = lib.mkEnableOption "enable pipewire for sound!";
  };

  config = lib.mkIf cfg.enable {
    security.rtkit.enable = true;

    environment.systemPackages = with pkgs; [
      qpwgraph # patching software
      pavucontrol # volume mixer
      pulsemixer
    ];

    services.pipewire = {
      enable = true;
      alsa = {
        enable = true;
        support32Bit = true;
      };
      pulse.enable = true;
      jack.enable = true;

      wireplumber = {
        enable = true;
        extraConfig = {
          "90-yveltal-renames" = {
            "monitor.alsa.rules" = [
              # audio sinks
              {
                matches = [
                  {
                    "node.name" = "alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__Speaker__sink";
                  }
                ];
                actions = {
                  "update-props" = {
                    "node.description" = "Speakers / 3.5mm";
                    "node.nick" = "Speakers / 3.5mm";
                  };
                };
              }
              {
                matches = [
                  {
                    "node.name" = "alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__HDMI1__sink";
                  }
                ];
                actions = {
                  "update-props" = {
                    "node.description" = "HDMI / DP 1";
                    "node.nick" = "HDMI / DP 1";
                  };
                };
              }
              {
                matches = [
                  {
                    "node.name" = "alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__HDMI2__sink";
                  }
                ];
                actions = {
                  "update-props" = {
                    "node.description" = "HDMI / DP 2";
                    "node.nick" = "HDMI / DP 2";
                  };
                };
              }
              {
                matches = [
                  {
                    "node.name" = "alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__HDMI3__sink";
                  }
                ];
                actions = {
                  "update-props" = {
                    "node.description" = "HDMI / DP 3";
                    "node.nick" = "HDMI / DP 3";
                  };
                };
              }
              # audio sources
              {
                matches = [
                  {
                    "node.name" = "alsa_input.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__Headset__source";
                  }
                ];
                actions = {
                  "update-props" = {
                    "node.description" = "3.5mm Mic";
                    "node.nick" = "3.5mm Mic";
                  };
                };
              }
              {
                matches = [
                  {
                    "node.name" = "alsa_input.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__Mic1__source";
                  }
                ];
                actions = {
                  "update-props" = {
                    "node.description" = "Laptop Mic";
                    "node.nick" = "Laptop Mic";
                  };
                };
              }
              # audio controllers
              {
                matches = [
                  {
                    "device.name" = "alsa_card.pci-0000_00_1f.3-platform-skl_hda_dsp_generic";
                  }
                ];
                actions = {
                  "update-props" = {
                    "node.description" = "Laptop Controller";
                    "node.nick" = "Laptop Controller";
                  };
                };
              }
            ];
          };
        };
      };
    };
  };
}
