about summary refs log tree commit diff
path: root/pkgs/kde/plasma/kinfocenter/default.nix
blob: 2ef5008905ace6206d195ad6e77dd164acc3b70c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{
  aha,
  clinfo,
  dmidecode,
  iproute2,
  lib,
  libusb1,
  mesa-demos,
  mkKdeDerivation,
  pciutils,
  pulseaudio,
  qttools,
  substituteAll,
  systemsettings,
  util-linux,
  vulkan-tools,
  wayland-utils,
  xdpyinfo,
}:
let
  tools = {
    aha = lib.getExe aha;
    clinfo = lib.getExe clinfo;
    dmidecode = lib.getExe' dmidecode "dmidecode";
    eglinfo = lib.getExe' mesa-demos "eglinfo";
    glxinfo = lib.getExe' mesa-demos "glxinfo";
    ip = lib.getExe' iproute2 "ip";
    lsblk = lib.getExe' util-linux "lsblk";
    lspci = lib.getExe' pciutils "lspci";
    lscpu = lib.getExe' util-linux "lscpu";
    pactl = lib.getExe' pulseaudio "pactl";
    qdbus = lib.getExe' qttools "qdbus";
    vulkaninfo = lib.getExe' vulkan-tools "vulkaninfo";
    waylandinfo = lib.getExe wayland-utils;
    xdpyinfo = lib.getExe xdpyinfo;
  };
in
mkKdeDerivation {
  pname = "kinfocenter";

  patches = [
    # fwupdmgr is provided through NixOS' module
    (substituteAll ({
      src = ./0001-tool-paths.patch;
    } // tools))
  ];

  postPatch = ''
    substituteInPlace kcms/firmware_security/fwupdmgr.sh \
      --replace-fail " aha " " ${lib.getExe aha} "
  '';

  extraBuildInputs = [libusb1];

  # fix wrong symlink of infocenter pointing to a 'systemsettings5' binary in
  # the same directory, while it is actually located in a completely different
  # store path
  preFixup = ''
    ln -sf ${systemsettings}/bin/systemsettings $out/bin/kinfocenter
  '';

  # Hardcoded as a QString, which is UTF-16 so Nix can't pick it up automatically
  postFixup = ''
    mkdir -p $out/nix-support
    echo "${lib.concatStringsSep ":" (lib.attrValues tools)}" > $out/nix-support/depends
  '';

  meta.mainProgram = "kinfocenter";
}