Moved scripts to the overlay folder to be used as packages

All scripts have been moved to the overlay folder in the top level directory

Overlay is now instantiated per configuration to make use of the host variable
This commit is contained in:
2024-11-16 03:42:07 -05:00
parent 2a2263d4cb
commit 8c007c3915
27 changed files with 200 additions and 175 deletions

View File

@@ -0,0 +1,18 @@
{ pkgs }:
pkgs.writeShellApplication {
name = "icanhazip";
runtimeInputs = with pkgs; [ iproute2 curl gawk coreutils ];
text = ''
if [ $# -eq 0 ]; then
echo "Public IP: $(curl -s icanhazip.com -4)"
ip route | awk '/default/ {print "Default Gateway: " $3} /src/ {print "Local IP: " $9}' | head -n 2
else case $1 in
"-p" ) echo "Public IP: $(curl -s icanhazip.com -4)";;
"-d" ) ip route | awk '/default/ {print $3}';;
"-l" ) ip route | awk '/src/ {print $9}';;
* ) echo "Options: -p, -d or -l for public ip, default gateway, and local ip respectively"; echo "i.e. icanhazip -p"
esac
fi
'';
}