1{
2 aha,
3 clinfo,
4 dmidecode,
5 iproute2,
6 lib,
7 libdisplay-info,
8 libusb1,
9 lm_sensors,
10 mesa-demos,
11 mkKdeDerivation,
12 pkg-config,
13 pciutils,
14 pulseaudio,
15 qttools,
16 replaceVars,
17 systemsettings,
18 util-linux,
19 vulkan-tools,
20 wayland-utils,
21 xdpyinfo,
22}:
23let
24 tools = {
25 aha = lib.getExe aha;
26 clinfo = lib.getExe clinfo;
27 di_edid_decode = lib.getExe libdisplay-info;
28 dmidecode = lib.getExe' dmidecode "dmidecode";
29 eglinfo = lib.getExe' mesa-demos "eglinfo";
30 glxinfo = lib.getExe' mesa-demos "glxinfo";
31 ip = lib.getExe' iproute2 "ip";
32 lsblk = lib.getExe' util-linux "lsblk";
33 lspci = lib.getExe' pciutils "lspci";
34 lscpu = lib.getExe' util-linux "lscpu";
35 pactl = lib.getExe' pulseaudio "pactl";
36 qdbus = lib.getExe' qttools "qdbus";
37 sensors = lib.getExe' lm_sensors "sensors";
38 vulkaninfo = lib.getExe' vulkan-tools "vulkaninfo";
39 waylandinfo = lib.getExe wayland-utils;
40 xdpyinfo = lib.getExe xdpyinfo;
41 };
42in
43mkKdeDerivation {
44 pname = "kinfocenter";
45
46 patches = [
47 # fwupdmgr is provided through NixOS' module
48 (replaceVars ./0001-tool-paths.patch (
49 {
50 # @QtBinariesDir@ only appears in the *removed* lines of the diff
51 QtBinariesDir = null;
52 }
53 // tools
54 ))
55 ];
56
57 postPatch = ''
58 substituteInPlace kcms/firmware_security/fwupdmgr.sh \
59 --replace-fail " aha " " ${lib.getExe aha} "
60 '';
61
62 extraNativeBuildInputs = [ pkg-config ];
63 extraBuildInputs = [ libusb1 ];
64
65 qtWrapperArgs = [ "--inherit-argv0" ];
66
67 # fix wrong symlink of infocenter pointing to a 'systemsettings5' binary in
68 # the same directory, while it is actually located in a completely different
69 # store path
70 preFixup = ''
71 ln -sf ${systemsettings}/bin/systemsettings $out/bin/kinfocenter
72 '';
73
74 # Hardcoded as a QString, which is UTF-16 so Nix can't pick it up automatically
75 postFixup = ''
76 mkdir -p $out/nix-support
77 echo "${lib.concatStringsSep ":" (lib.attrValues tools)}" > $out/nix-support/depends
78 '';
79
80 meta.mainProgram = "kinfocenter";
81}