config/modules/impurity-logger/default.nix

16 lines
454 B
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
2023-11-13 22:22:36 +02:00
let
mkTracer = name: target: exe: lib.getExe (pkgs.writeShellScriptBin name ''
echo "PID $PPID executed ${target}" |& ${config.systemd.package}/bin/systemd-cat --identifier=impurity >/dev/null 2>/dev/null
2023-11-13 22:22:36 +02:00
exec -a "$0" '${exe}' "$@"
'');
in
{
environment = {
usrbinenv = mkTracer "env" "/usr/bin/env" "${pkgs.coreutils}/bin/env";
binsh = mkTracer "sh" "/bin/sh" "${pkgs.bashInteractive}/bin/sh";
};
}