diff --git a/configuration.nix b/configuration.nix index 2c455e3..e6b1a65 100644 --- a/configuration.nix +++ b/configuration.nix @@ -148,6 +148,21 @@ in ]; }; + systemd.services.fix-wifi = { + path = [ pkgs.bash ]; + script = '' + sleep 5 + if ping -q -c1 10.0.1.1 &>/dev/null; then + echo "No need to fix wifi" + else + echo 1 | tee /sys/bus/pci/devices/0000\:09\:00.0/reset + rmmod iwlwifi + modprobe iwlwifi + fi + ''; + wantedBy = [ "multi-user.target" ]; + }; + # Networking configs networking = { hostName = hostname; diff --git a/home.nix b/home.nix index 38fbdf7..d78338e 100644 --- a/home.nix +++ b/home.nix @@ -20,22 +20,22 @@ ]; # custom systemd services - systemd.user.services.fix-wifi = { - Unit = { - Description = "Reset wifi adapter so that it works on boot consistently."; - }; - Install = { - WantedBy = [ "default.target" ]; - }; - Service = { - ExecStart = "/home/matt/nix-config/scripts/reset_wifi"; - # ExecStart = "${pkgs.writeShellScript "fix-wifi" '' - # #!/usr/bin/env bash - # echo 1 | sudo -u root tee /sys/bus/pci/devices/0000\:09\:00.0/reset - # sudo rmmod iwlwifi - # sudo modprobe iwlwifi - # ''}"; - }; - }; + # systemd.user.services.fix-wifi = { + # Unit = { + # Description = "Reset wifi adapter so that it works on boot consistently."; + # }; + # Install = { + # WantedBy = [ "default.target" ]; + # }; + # Service = { + # ExecStart = "/home/matt/nix-config/scripts/reset_wifi"; + # # ExecStart = "${pkgs.writeShellScript "fix-wifi" '' + # # #!/usr/bin/env bash + # # echo 1 | sudo -u root tee /sys/bus/pci/devices/0000\:09\:00.0/reset + # # sudo rmmod iwlwifi + # # sudo modprobe iwlwifi + # # ''}"; + # }; + # }; } \ No newline at end of file