config/pkgs/nicer.nix

26 lines
619 B
Nix
Raw Normal View History

2024-07-29 15:39:54 +03:00
{ coreutils, writeShellApplication }:
2024-02-05 09:19:16 +02:00
writeShellApplication {
name = "nicer";
text = ''
f=$(${coreutils}/bin/mktemp)
trap '${coreutils}/bin/rm -f "$f"' EXIT
${coreutils}/bin/env > "$f"
systemd-run \
--user \
--same-dir \
--slice nicer \
--nice=19 \
--property CPUSchedulingPolicy=idle \
--property IOSchedulingClass=idle \
--property IOSchedulingPriority=7 \
--pty \
--pipe \
--wait \
--collect \
--quiet \
--property EnvironmentFile="$f" \
--service-type=exec \
-- "$@"
'';
}