Compare commits
2 commits
2b77681552
...
8b7ae65494
Author | SHA1 | Date | |
---|---|---|---|
Antoine Martin | 8b7ae65494 | ||
Antoine Martin | bb0ea0a5c8 |
|
@ -69,51 +69,7 @@ in {
|
||||||
inherit (pkgs.libsForQt5) okular;
|
inherit (pkgs.libsForQt5) okular;
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.networkmanager = {
|
networking.networkmanager.enable = true;
|
||||||
enable = true;
|
|
||||||
|
|
||||||
dispatcherScripts = [
|
|
||||||
{
|
|
||||||
source = let
|
|
||||||
grep = "${pkgs.gnugrep}/bin/grep";
|
|
||||||
nmcli = "${pkgs.networkmanager}/bin/nmcli";
|
|
||||||
in
|
|
||||||
pkgs.writeShellScript "disable_wifi_on_ethernet" ''
|
|
||||||
export LC_ALL=C
|
|
||||||
date >> /tmp/disable_wifi_on_ethernet.log
|
|
||||||
echo START "$@" >> /tmp/disable_wifi_on_ethernet.log
|
|
||||||
|
|
||||||
beginswith() { case $2 in "$1"*) true;; *) false;; esac; }
|
|
||||||
|
|
||||||
is_ethernet_interface ()
|
|
||||||
{
|
|
||||||
local type="$(${nmcli} dev show "$1" | grep 'GENERAL\.TYPE:' | awk '{ print $2 }')"
|
|
||||||
test "$type" = "ethernet" || beginswith enp "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
hotspot_enabled ()
|
|
||||||
{
|
|
||||||
${nmcli} dev | ${grep} -q "hotspot"
|
|
||||||
}
|
|
||||||
|
|
||||||
if is_ethernet_interface "$1" && ! hotspot_enabled; then
|
|
||||||
echo "change in ethernet and not in hotspot mode" >> /tmp/disable_wifi_on_ethernet.log
|
|
||||||
if [ "$2" = "up" ]; then
|
|
||||||
echo "turning wifi off" >> /tmp/disable_wifi_on_ethernet.log
|
|
||||||
nmcli radio wifi off
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$2" = "down" ]; then
|
|
||||||
echo "turning wifi on" >> /tmp/disable_wifi_on_ethernet.log
|
|
||||||
nmcli radio wifi on
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
echo END "$@" >> /tmp/disable_wifi_on_ethernet.log
|
|
||||||
'';
|
|
||||||
type = "basic";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
programs.nm-applet.enable = true;
|
programs.nm-applet.enable = true;
|
||||||
programs.steam.enable = true;
|
programs.steam.enable = true;
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,6 @@
|
||||||
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
|
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
dconf.enable = true;
|
|
||||||
light.enable = true;
|
light.enable = true;
|
||||||
};
|
};
|
||||||
services = {
|
services = {
|
||||||
|
|
Loading…
Reference in a new issue