2023-06-07 19:52:24 +02:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2023-06-09 08:04:30 +02:00
|
|
|
# The lttng btrfs probe crashes at compile time because of an undefined
|
2023-06-07 19:52:24 +02:00
|
|
|
# function. This disables the btrfs tracepoints to avoid the issue.
|
2023-06-09 08:04:30 +02:00
|
|
|
|
|
|
|
# Also enable lockdep tracepoints, this is disabled by default because it
|
|
|
|
# does not work well on architectures other than x86_64 (i think that arm) as
|
|
|
|
# I was told on the mailing list.
|
2023-06-07 19:52:24 +02:00
|
|
|
lttng-modules-fixed = config.boot.kernelPackages.lttng-modules.overrideAttrs (finalAttrs: previousAttrs: {
|
|
|
|
patchPhase = (lib.optionalString (previousAttrs ? patchPhase) previousAttrs.patchPhase) + ''
|
2023-06-09 08:04:30 +02:00
|
|
|
# disable btrfs
|
2023-06-07 19:52:24 +02:00
|
|
|
substituteInPlace src/probes/Kbuild \
|
|
|
|
--replace " obj-\$(CONFIG_LTTNG) += lttng-probe-btrfs.o" " #obj-\$(CONFIG_LTTNG) += lttng-probe-btrfs.o"
|
2023-06-09 08:04:30 +02:00
|
|
|
|
|
|
|
# enable lockdep tracepoints
|
|
|
|
substituteInPlace src/probes/Kbuild \
|
|
|
|
--replace "#ifneq (\$(CONFIG_LOCKDEP),)" "ifneq (\$(CONFIG_LOCKDEP),)" \
|
|
|
|
--replace "# obj-\$(CONFIG_LTTNG) += lttng-probe-lock.o" " obj-\$(CONFIG_LTTNG) += lttng-probe-lock.o" \
|
|
|
|
--replace "#endif # CONFIG_LOCKDEP" "endif # CONFIG_LOCKDEP"
|
2023-06-07 19:52:24 +02:00
|
|
|
'';
|
|
|
|
});
|
|
|
|
in {
|
|
|
|
|
|
|
|
# add the lttng tools and modules to the system environment
|
|
|
|
boot.extraModulePackages = [ lttng-modules-fixed ];
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
lttng-tools lttng-ust babeltrace
|
|
|
|
];
|
|
|
|
|
|
|
|
# start the lttng root daemon to manage kernel events
|
|
|
|
systemd.services.lttng-sessiond = {
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
description = "LTTng session daemon for the root user";
|
|
|
|
serviceConfig = {
|
|
|
|
User = "root";
|
|
|
|
ExecStart = ''
|
|
|
|
${pkgs.lttng-tools}/bin/lttng-sessiond
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|