pkgs: cmd: pname: pkgs.writeShellScriptBin "watch" '' while true do ${cmd} & ${pkgs.inotify-tools}/bin/inotifywait -e modify -r . pkill ${pname} done ''