networking: modify proxy configurations

- removed `environment.systemPackages = with pkgs; [ clash-meta ];`,
  as I found it isn't nessessary...
- use same environment variables on different platforms and alias
This commit is contained in:
Guanran Wang 2023-10-10 17:05:33 +08:00
parent 78010ed6e9
commit 84bfa9817a
Signed by: nyancat
SSH key fingerprint: SHA256:8oWGKciPALWut/6WA27oFKofX+6Wtc0gQnsefXLQx/8
3 changed files with 8 additions and 15 deletions

View file

@ -1,14 +1,9 @@
{ pkgs, config, ... }: { pkgs, config, ... }:
{ {
networking = { networking.proxy.default = "http://127.0.0.1:7890/";
proxy = {
default = "http://127.0.0.1:7890/";
noProxy = "127.0.0.1,localhost";
};
};
environment.systemPackages = with pkgs; [ clash-meta ]; #environment.systemPackages = with pkgs; [ clash-meta ];
systemd.services."clash-meta" = { systemd.services."clash-meta" = {
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
after = [ "network-online.target" ]; after = [ "network-online.target" ];

View file

@ -12,10 +12,7 @@
# changes in each release. # changes in each release.
stateVersion = "23.05"; stateVersion = "23.05";
shellAliases = shellAliases = {
let
proxy = "http://127.0.0.1:7890/";
in {
# navigation # navigation
"l" = "${pkgs.eza}/bin/eza -Fhl --icons --git"; "l" = "${pkgs.eza}/bin/eza -Fhl --icons --git";
"ll" = "${pkgs.eza}/bin/eza -Fahl --icons --git"; "ll" = "${pkgs.eza}/bin/eza -Fahl --icons --git";
@ -37,7 +34,8 @@
"clock" = "tty-clock -5Ccs"; "clock" = "tty-clock -5Ccs";
# proxy # proxy
"setproxy" = "export https_proxy=${proxy} http_proxy=${proxy} all_proxy=${proxy}"; "setproxy" = let proxy = "http://127.0.0.1:7890/";
in "export http_proxy=${proxy} https_proxy=${proxy} ftp_proxy=${proxy} rsync_proxy=${proxy}";
"unsetproxy" = "set -e http_proxy https_proxy all_proxy"; # fish syntax (?) "unsetproxy" = "set -e http_proxy https_proxy all_proxy"; # fish syntax (?)
}; };
sessionVariables = { sessionVariables = {

View file

@ -65,10 +65,10 @@
]; ];
sessionVariables = { sessionVariables = {
"https_proxy" = "http://127.0.0.1:7890";
"http_proxy" = "http://127.0.0.1:7890"; "http_proxy" = "http://127.0.0.1:7890";
"socks_proxy" = "socks5://127.0.0.1:7890"; "https_proxy" = "http://127.0.0.1:7890";
"all_proxy" = "socks5://127.0.0.1:7890"; "ftp_proxy" = "http://127.0.0.1:7890";
"rsync_proxy" = "http://127.0.0.1:7890";
}; };
}; };