General cleanup

This commit is contained in:
Sridhar Ratnakumar 2023-07-22 11:17:45 -04:00
parent f9cf0def19
commit 66dcd9d9b6
7 changed files with 100 additions and 291 deletions

16
scripts/fuckport.nix Normal file
View file

@ -0,0 +1,16 @@
{ writeShellApplication, jc, jq, ... }:
# Kill the process with the port open
# Used only to kill stale ghc.
# FIXME: This doesn't work when lsof returns *multiple* processes.
writeShellApplication {
name = "fuckport";
runtimeInputs = [ jc jq ];
text = ''
lsof -i :"$1"
THEPID=$(lsof -i :"$1" | jc --lsof 2> /dev/null | jq '.[].pid')
echo "KILL $THEPID ?"
read -r
kill "$THEPID"
'';
}