warp-cli fix + yazi + some app settings

This commit is contained in:
Your Name 2024-05-31 05:51:51 +03:00
parent 85ee87763c
commit 988a90039e
9 changed files with 138 additions and 30 deletions

View file

@ -70,11 +70,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1716035127, "lastModified": 1717067691,
"narHash": "sha256-qqxeTHGDvCcer1QEGlu81MmRfbkNHBqCD9Ue7S2yHBE=", "narHash": "sha256-WEOgDjuEs2r/5YSlFTVrACdNdL7kLACEAV2U/G0Q1Yk=",
"owner": "nix-community", "owner": "nix-community",
"repo": "flake-firefox-nightly", "repo": "flake-firefox-nightly",
"rev": "ee25f2df1923145abee8aa8096f9b45065b535fb", "rev": "bfb1041c5c92ab530b1b026762a5fa56af5d7a4c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -495,11 +495,11 @@
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib"
}, },
"locked": { "locked": {
"lastModified": 1715515815, "lastModified": 1716725378,
"narHash": "sha256-yaLScMHNFCH6SbB0HSA/8DWDgK0PyOhCXoFTdHlWkhk=", "narHash": "sha256-bNTVDAVBLFSSTU+q54cJnntmFKBi+F/D8sSqlZwBGiM=",
"owner": "nix-community", "owner": "nix-community",
"repo": "lib-aggregate", "repo": "lib-aggregate",
"rev": "09883ca828e8cfaacdb09e29190a7b84ad1d9925", "rev": "dbc9130fe1455e0f6ee4d8f5f799f9be551f866b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -563,11 +563,11 @@
}, },
"nixpkgs-lib": { "nixpkgs-lib": {
"locked": { "locked": {
"lastModified": 1715474941, "lastModified": 1716684580,
"narHash": "sha256-CNCqCGOHdxuiVnVkhTpp2WcqSSmSfeQjubhDOcgwGjU=", "narHash": "sha256-sIbMJWJr4hl2PWd9/iWlh89QfVzBn1NJ3u5RjeZADuM=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixpkgs.lib", "repo": "nixpkgs.lib",
"rev": "58e03b95f65dfdca21979a081aa62db0eed6b1d8", "rev": "d0d27192931680482081aa1c38389da2af84a651",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -640,6 +640,22 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs2305": {
"locked": {
"lastModified": 1704290814,
"narHash": "sha256-LWvKHp7kGxk/GEtlrGYV68qIvPHkU9iToomNFGagixU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "70bdadeb94ffc8806c0570eb5c2695ad29f0e421",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1715534503, "lastModified": 1715534503,
@ -785,6 +801,7 @@
"nixpkgs-stable": "nixpkgs-stable", "nixpkgs-stable": "nixpkgs-stable",
"nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-unstable": "nixpkgs-unstable",
"nixpkgs2105": "nixpkgs2105", "nixpkgs2105": "nixpkgs2105",
"nixpkgs2305": "nixpkgs2305",
"nixvim": "nixvim", "nixvim": "nixvim",
"secrets": "secrets", "secrets": "secrets",
"shwewo": "shwewo" "shwewo": "shwewo"

View file

@ -6,6 +6,8 @@
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.11"; nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.11";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs2105.url = "github:NixOS/nixpkgs/nixos-21.05"; nixpkgs2105.url = "github:NixOS/nixpkgs/nixos-21.05";
nixpkgs2305.url = "github:NixOS/nixpkgs/nixos-23.05";
home-manager.url = "github:nix-community/home-manager"; home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";

View file

@ -6,6 +6,7 @@
imports = [ imports = [
./theme.nix ./theme.nix
../pkgs/helix ../pkgs/helix
../pkgs/yazi
]; ];
#services.blueman-applet.enable = true; #services.blueman-applet.enable = true;
@ -13,7 +14,6 @@
programs.vscode = { programs.vscode = {
enable = true; enable = true;
package = pkgs.vscode; package = pkgs.vscode;
extensions = with pkgs.vscode-extensions; [ extensions = with pkgs.vscode-extensions; [
matklad.rust-analyzer matklad.rust-analyzer
jnoortheen.nix-ide jnoortheen.nix-ide
@ -143,7 +143,7 @@
background_opacity = "0.8"; background_opacity = "0.8";
remember_window_size = "no"; remember_window_size = "no";
hide_window_decorations = "yes"; hide_window_decorations = "yes";
remote_control_password = "kitty-notification-password-fish ls"; remote_control_password = "kitty-notification-password-fish ls, kitty-password-scripts ls set-tab-* resize-* send-text";
allow_remote_control = "password"; allow_remote_control = "password";
font_family= "FiraCode"; font_family= "FiraCode";
font_features = "FiraCode +ss01 +ss02 +ss06 +ss08 +cv14 +cv03 +tnum"; font_features = "FiraCode +ss01 +ss02 +ss06 +ss08 +cv14 +cv03 +tnum";

View file

@ -31,6 +31,7 @@ in {
#]; #];
users.users.delta.packages = (with pkgs; [ users.users.delta.packages = (with pkgs; [
gitleaks
git git
#chromium #chromium
wl-clipboard wl-clipboard

View file

@ -37,6 +37,7 @@
space.q = ":q"; space.q = ":q";
esc = [ "collapse_selection" "keep_primary_selection" ]; esc = [ "collapse_selection" "keep_primary_selection" ];
C-f = [":new" ":insert-output lf -selection-path=/dev/stdout" "split_selection_on_newline" "goto_file" "goto_last_modification" "goto_last_modified_file" ":buffer-close!" ":redraw"]; C-f = [":new" ":insert-output lf -selection-path=/dev/stdout" "split_selection_on_newline" "goto_file" "goto_last_modification" "goto_last_modified_file" ":buffer-close!" ":redraw"];
# C-d = [":new" ":insert-output /home/delta/scripts/temp/yazi-choser.sh -selection-path=/dev/stdout" "split_selection_on_newline" "goto_file" "goto_last_modification" "goto_last_modified_file" ":buffer-close!" ":redraw"];
}; };
}; };

View file

@ -50,10 +50,5 @@
# "https://github.com/zakk4223/hyprland-easymotion" # "https://github.com/zakk4223/hyprland-easymotion"
# ]; # ];
}; };
# home.activation = {
# unlink_hyprland = lib.hm.dag.entryAfter ["onFilesChange"] ''
# unlink /home/delta/.config/hypr/hyprland.conf
# '';
# };
}; };
} }

View file

@ -7,7 +7,7 @@
# monitor=eDP-1,2944x1840@60,auto,1.333333 # monitor=eDP-1,2944x1840@60,auto,1.333333
# monitor=eDP-1,preferred,auto,1.6 # monitor=eDP-1,preferred,auto,1.6
monitor=eDP-1,preferred,auto,2 monitor=eDP-1,preferred,auto,1.333333
#monitor=eDP-1,preferred,auto,1.066667 #monitor=eDP-1,preferred,auto,1.066667
#source = ~/.config/hypr/monitors.conf #source = ~/.config/hypr/monitors.conf
@ -217,6 +217,7 @@ gestures {
#windowrule = float, ^(kitty)$ #windowrule = float, ^(kitty)$
windowrule = float,^(pavucontrol)$ windowrule = float,^(pavucontrol)$
windowrule = float,^(blueman-manager)$ windowrule = float,^(blueman-manager)$
windowrule = float,^(.blueman-manager-wrapped)$
windowrule = float,^(nm-connection-editor)$ windowrule = float,^(nm-connection-editor)$
#windowrule = float,^(chromium)$ #windowrule = float,^(chromium)$
windowrule = float,^(thunar)$ windowrule = float,^(thunar)$

View file

@ -1,5 +1,6 @@
{ pkgs, lib, inputs, ... }: { pkgs, lib, inputs, ... }:
let let
nixpkgs2305 = import inputs.nixpkgs2305 { system = "${pkgs.system}"; config = { allowUnfree = true; }; };
socksBuilder = attrs: socksBuilder = attrs:
{ {
inherit (attrs) name; inherit (attrs) name;
@ -33,12 +34,10 @@ let
}; };
}; };
# IP of the proxies is 192.168.150.2 socksed = [ # IP of the proxies is 192.168.150.2
{ name = "singbox-aus"; script = "sing-box run -c /run/secrets/singbox-aus";} # port 4000
socksed = [ # gost port 4780 direct proxy { name = "socks-warp"; script = "wireproxy -c /etc/wireguard/cproxy.conf"; } # port 3333
{ name = "singbox-aus"; script = "sing-box run -c /run/secrets/singbox-aus"; } # port 4000 { name = "socks-novpn"; script = "gost -L socks5://192.168.150.2:3334"; } # port 3334
{ name = "socks-warp"; script = "wireproxy -c /etc/wireguard/warp0.conf"; } # port 3333
{ name = "socks-novpn"; script = "gost -L socks5://192.168.150.2:3334"; } # port 3334
]; ];
delete_rules = pkgs.writeScriptBin "delete_rules" '' delete_rules = pkgs.writeScriptBin "delete_rules" ''
@ -167,17 +166,17 @@ in {
StateDirectory = "cloudflare-warp"; StateDirectory = "cloudflare-warp";
RuntimeDirectory = "cloudflare-warp"; RuntimeDirectory = "cloudflare-warp";
LogsDirectory = "cloudflare-warp"; LogsDirectory = "cloudflare-warp";
ExecStart = "${pkgs.cloudflare-warp}/bin/warp-svc"; ExecStart = "${nixpkgs2305.cloudflare-warp}/bin/warp-svc";
}; };
postStart = '' postStart = ''
while true; do while true; do
set -e set -e
status=$(${pkgs.cloudflare-warp}/bin/warp-cli status || true) status=$(${nixpkgs2305.cloudflare-warp}/bin/warp-cli status || true)
set +e set +e
if [[ "$status" != *"Unable to connect to CloudflareWARP daemon"* ]]; then if [[ "$status" != *"Unable to connect to CloudflareWARP daemon"* ]]; then
${pkgs.cloudflare-warp}/bin/warp-cli set-custom-endpoint 162.159.193.1:2408 ${nixpkgs2305.cloudflare-warp}/bin/warp-cli set-custom-endpoint 162.159.193.1:2408
exit 0 exit 0
fi fi
sleep 1 sleep 1
@ -188,18 +187,36 @@ in {
tor.wantedBy = lib.mkForce []; tor.wantedBy = lib.mkForce [];
}; };
users.users.delta.packages = [ environment.systemPackages = [
(pkgs.writeScriptBin "nyx" ''sudo -u tor -g tor ${inputs.nixpkgs2105.legacyPackages."x86_64-linux".nyx}/bin/nyx $@'') (pkgs.writeScriptBin "warp-cli" "${nixpkgs2305.cloudflare-warp}/bin/warp-cli $@")
(pkgs.writeScriptBin "nyx" ''sudo -u tor -g tor ${inputs.nixpkgs2105.legacyPackages."${pkgs.system}".nyx}/bin/nyx $@'')
(pkgs.writeScriptBin "tor-warp" ''
if [[ "$1" == "start" ]]; then
echo "Starting..."
warp-cli set-mode proxy
warp-cli set-proxy-port 4000
sudo systemctl start tor
elif [[ "$1" == "stop" ]]; then
echo "Stopping..."
warp-cli set-mode warp
sudo systemctl stop tor
else
echo "Error: specify start or stop"
fi
'')
]; ];
services.tor = { services.tor = {
enable = true; enable = true;
client = { client = {
enable = true; enable = true;
socksListenAddress = 9063; socksListenAddress = 9050;
}; };
settings = { settings = {
Socks5Proxy = "192.168.150.2:3333"; # UseBridges = true;
# ClientTransportPlugin = "snowflake exec ${pkgs.snowflake}/bin/client";
# Bridge = "snowflake 192.0.2.3:80 2B280B23E1107BB62ABFC40DDCC8824814F80A72 fingerprint=2B280B23E1107BB62ABFC40DDCC8824814F80A72 url=https://snowflake-broker.torproject.net.global.prod.fastly.net/ fronts=www.shazam.com,www.cosmopolitan.com,www.esquire.com ice=stun:stun.l.google.com:19302,stun:stun.antisip.com:3478,stun:stun.bluesip.net:3478,stun:stun.dus.net:3478,stun:stun.epygi.com:3478,stun:stun.sonetel.com:3478,stun:stun.uls.co.za:3478,stun:stun.voipgate.com:3478,stun:stun.voys.nl:3478 utls-imitate=hellorandomizedalpn";
Socks5Proxy = "localhost:4000"; # requires setting warp-svc to proxy mode: warp-cli set-mode proxy && warp-cli set-proxy-port 4000
ControlPort = 9051; ControlPort = 9051;
CookieAuthentication = true; CookieAuthentication = true;
}; };

74
pkgs/yazi/default.nix Normal file
View file

@ -0,0 +1,74 @@
{ pkgs, lib, ... }:
{
programs.yazi = {
enable = true;
# enableFishIntegration = true;
};
home.file.".config/yazi/yazi.toml".text = ''
[[manager.prepend_keymap]]
on = [ "l" ]
run = "plugin --sync smart-enter"
desc = "Enter the child directory, or open the file"
[[manager.prepend_keymap]]
on = [ "p" ]
run = "plugin --sync smart-paste"
desc = "Paste into the hovered directory or CWD"
[[manager.prepend_keymap]]
on = [ "<C-s>" ]
run = 'shell "$SHELL" --block --confirm'
desc = "Open shell here"
[[manager.prepend_keymap]]
on = [ "T" ]
run = "plugin --sync max-preview"
'';
home.file.".config/yazi/plugins/smart-enter.yazi/init.lua".text = ''
return {
entry = function()
local h = cx.active.current.hovered
ya.manager_emit(h and h.cha.is_dir and "enter" or "open", { hovered = true })
end,
}
'';
home.file.".config/yazi/plugins/smart-paste.yazi/init.lua".text = ''
return {
entry = function()
local h = cx.active.current.hovered
if h and h.cha.is_dir then
ya.manager_emit("enter", {})
ya.manager_emit("paste", {})
ya.manager_emit("leave", {})
else
ya.manager_emit("paste", {})
end
end,
}
'';
home.file.".config/yazi/plugins/max-preview.yazi/init.lua".text = ''
local function entry(st)
if st.old then
Manager.layout, st.old = st.old, nil
else
st.old = Manager.layout
Manager.layout = function(self, area)
self.area = area
return ui.Layout()
:direction(ui.Layout.HORIZONTAL)
:constraints({
ui.Constraint.Percentage(0),
ui.Constraint.Percentage(0),
ui.Constraint.Percentage(100),
})
:split(area)
end
end
ya.app_emit("resize", {})
end
return { entry = entry }
'';
}