nixos/ananicy: re enable BPF on hardened kernels

This was a workaround to begin with, as hardened kernel didn't support tracing.
Back then kernel level tracing was only available through debugfs, and now that
tracefs has been available on NixOS for a while now, enabled in
Link: https://github.com/NixOS/nixpkgs/pull/388751

This workaround can be removed and bpf can be used with tracefs.
Link: https://github.com/NixOS/nixpkgs/issues/360957

Signed-off-by: John Titor <50095635+JohnRTitor@users.noreply.github.com>
This commit is contained in:
John Titor 2025-03-29 07:39:04 +05:30 committed by Masum Reza
commit 51dc163364

View file

@ -19,12 +19,6 @@ let
);
servicename =
if ((lib.getName cfg.package) == (lib.getName pkgs.ananicy-cpp)) then "ananicy-cpp" else "ananicy";
# Ananicy-CPP with BPF is not supported on hardened kernels https://github.com/NixOS/nixpkgs/issues/327382
finalPackage =
if (servicename == "ananicy-cpp" && config.boot.kernelPackages.isHardened) then
(cfg.package.override { withBpf = false; })
else
cfg.package;
in
{
options.services.ananicy = {
@ -113,7 +107,7 @@ in
config = lib.mkIf cfg.enable {
environment = {
systemPackages = [ finalPackage ];
systemPackages = [ cfg.package ];
etc."ananicy.d".source =
pkgs.runCommand "ananicyfiles"
{
@ -170,7 +164,7 @@ in
);
systemd = {
packages = [ finalPackage ];
packages = [ cfg.package ];
services."${servicename}" = {
wantedBy = [ "default.target" ];
};