25 lines
638 B
Nix
25 lines
638 B
Nix
|
{
|
||
|
flake.modules.homeManager.gui =
|
||
|
{ pkgs, ... }:
|
||
|
{
|
||
|
home.packages = [
|
||
|
(pkgs.writeShellApplication {
|
||
|
name = "status-network";
|
||
|
|
||
|
runtimeInputs = with pkgs; [ networkmanager ];
|
||
|
|
||
|
text = ''
|
||
|
connected_to="$(nmcli | grep "connected to")"
|
||
|
|
||
|
network_name="$(echo "$connected_to" | awk '{print $NF}')"
|
||
|
connected_device="$(echo "$connected_to" | cut -d ':' -f 1)"
|
||
|
|
||
|
ip_address="$(ip a | grep "$connected_device" | grep inet | awk '{print $2}'| cut -d '/' -f 1)"
|
||
|
|
||
|
echo "$network_name $ip_address"
|
||
|
'';
|
||
|
})
|
||
|
];
|
||
|
};
|
||
|
}
|