Commit 7b1a0999285b
Changed files (1)
systems
modules
desktop
systems/modules/desktop/base.nix
@@ -71,6 +71,33 @@ in
++ lib.optionals config.virtualisation.docker.enable [ "interface-name:docker0" ]
# Do not manager libvirt interfaces
++ lib.optionals config.virtualisation.libvirtd.enable [ "interface-name:virbr*" ];
+ packages = with pkgs; [ networkmanager-openvpn ];
+ dispatcherScripts = [{
+ # https://askubuntu.com/questions/1271491/disable-wifi-if-lan-is-connected
+ source = pkgs.writeText "wifi-wired-exclusive" ''
+ #!${pkgs.bash}/bin/bash
+ export LC_ALL=C
+
+ enable_disable_wifi ()
+ {
+ result=$(${pkgs.networkmanager}/bin/nmcli dev | ${pkgs.gnugrep}/bin/grep "ethernet" | ${pkgs.gnugrep}/bin/grep -w "connected")
+ if [ -n "$result" ]; then
+ ${pkgs.networkmanager}/bin/nmcli radio wifi off
+ else
+ ${pkgs.networkmanager}/bin/nmcli radio wifi on
+ fi
+ }
+
+ if [ "$2" = "up" ]; then
+ enable_disable_wifi
+ fi
+
+ if [ "$2" = "down" ]; then
+ enable_disable_wifi
+ fi
+ '';
+ type = "basic";
+ }];
};
nix = {