{ serviceName, binaryPath, errorPath, from, to }: let daemon = import ./daemon.nix; configurationFile = builtins.toFile "error-reporter-config.json" (builtins.toJSON { errorPath = errorPath; stackFilter = "*"; subjectFormat = "UNHANDLED ERROR: $type - $message"; metadata = { from = from; to = to; }; }); in { pkgs, lib, ... }: { imports = [ (daemon { name = "${serviceName}-error-reporter"; displayName = "${serviceName} Error Reporter"; fakeHome = false; binaryPath = "${binaryPath} ${configurationFile}"; environmentVariables = {}; prepare = '' mkdir -m 0700 -p ${errorPath} chown ${serviceName} ${errorPath} ''; before = [ "${serviceName}.service" ]; }) ]; }