1{
2 lib,
3 mkKdeDerivation,
4 writeText,
5 pkg-config,
6 cryptsetup,
7 lvm2,
8 mdadm,
9 smartmontools,
10 systemdMinimal,
11 util-linux,
12 btrfs-progs,
13 dosfstools,
14 e2fsprogs,
15 exfatprogs,
16 f2fs-tools,
17 fatresize,
18 jfsutils,
19 nilfs-utils,
20 ntfs3g,
21 udftools,
22 xfsprogs,
23 zfs,
24}:
25let
26 # https://github.com/KDE/kpmcore/blob/06f15334ecfbe871730a90dbe2b694ba060ee998/src/util/externalcommand_whitelist.h
27 runtimeDeps = [
28 cryptsetup
29 lvm2
30 mdadm
31 smartmontools
32 systemdMinimal
33 util-linux
34
35 btrfs-progs
36 dosfstools
37 e2fsprogs
38 exfatprogs
39 f2fs-tools
40 fatresize
41 # hfsprogs intentionally omitted due to being unmaintained
42 jfsutils
43 nilfs-utils
44 ntfs3g
45 # reiser{4,fs}progs intentionally omitted due to filesystem removal from Linux.
46 udftools
47 xfsprogs
48 zfs
49
50 # FIXME: Missing command: hfsck hformat fsck.nilfs2 {fsck,mkfs,debugfs,tunefs}.ocfs2
51 # FIXME: audit to see if these are all still required
52 ];
53
54 trustedprefixes = writeText "kpmcore-trustedprefixes" (
55 lib.concatStringsSep "\n" (map lib.getBin runtimeDeps)
56 );
57in
58mkKdeDerivation {
59 pname = "kpmcore";
60
61 postPatch = ''
62 cp ${trustedprefixes} src/util/trustedprefixes
63 '';
64
65 preConfigure = ''
66 substituteInPlace src/util/CMakeLists.txt \
67 --replace \$\{POLKITQT-1_POLICY_FILES_INSTALL_DIR\} $out/share/polkit-1/actions
68 substituteInPlace src/backend/corebackend.cpp \
69 --replace /usr/share/polkit-1/actions/org.kde.kpmcore.externalcommand.policy $out/share/polkit-1/actions/org.kde.kpmcore.externalcommand.policy
70 '';
71
72 extraNativeBuildInputs = [ pkg-config ];
73}