sutff
This commit is contained in:
parent
be1f43a101
commit
cde1d476aa
15 changed files with 435 additions and 217 deletions
3
TESTING
3
TESTING
|
|
@ -1,3 +0,0 @@
|
||||||
laptop gpu lag after time
|
|
||||||
laptop bcachefs corruption
|
|
||||||
laptop cosmic
|
|
||||||
|
|
@ -3,10 +3,12 @@
|
||||||
services.displayManager.cosmic-greeter.enable = false;
|
services.displayManager.cosmic-greeter.enable = false;
|
||||||
services.desktopManager.cosmic.enable = true;
|
services.desktopManager.cosmic.enable = true;
|
||||||
|
|
||||||
|
environment.sessionVariables.COSMIC_DATA_CONTROL_ENABLED = 1;
|
||||||
|
|
||||||
environment.cosmic.excludePackages = with pkgs; [
|
environment.cosmic.excludePackages = with pkgs; [
|
||||||
cosmic-player
|
|
||||||
cosmic-wallpapers
|
|
||||||
cosmic-term
|
|
||||||
cosmic-edit
|
cosmic-edit
|
||||||
|
cosmic-player
|
||||||
|
cosmic-term
|
||||||
|
cosmic-wallpapers
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,50 +6,47 @@
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
users.users.tao.packages = with pkgs; [
|
users.users.tao.packages = with pkgs; [
|
||||||
usbutils
|
# calibre
|
||||||
freecad-wayland
|
|
||||||
piper
|
|
||||||
mousai
|
|
||||||
toastify
|
|
||||||
man-pages
|
|
||||||
man-pages-posix
|
|
||||||
gurk-rs
|
|
||||||
# davinci-resolve
|
# davinci-resolve
|
||||||
nufmt
|
|
||||||
freerdp
|
|
||||||
nixos-anywhere
|
|
||||||
cloud-hypervisor
|
|
||||||
# fractal
|
# fractal
|
||||||
# kdeconnect
|
# inputs.plasma-manager.packages.${pkgs.system}.default
|
||||||
|
# jellyfin-mpv-shim
|
||||||
# libsForQt5.kcharselect
|
# libsForQt5.kcharselect
|
||||||
# mendeley
|
# mendeley
|
||||||
# slack
|
# slack
|
||||||
# tectonic
|
# tectonic
|
||||||
# texlab
|
# texlab
|
||||||
# toastify
|
|
||||||
# wkhtmltopdf
|
# wkhtmltopdf
|
||||||
appimage-run
|
appimage-run
|
||||||
aspell
|
aspell
|
||||||
aspellDicts.en
|
aspellDicts.en
|
||||||
bottles
|
bottles
|
||||||
boxxy
|
boxxy
|
||||||
# calibre
|
carapace
|
||||||
|
cloud-hypervisor
|
||||||
darktable
|
darktable
|
||||||
deluge
|
deluge
|
||||||
discord
|
discord
|
||||||
# inputs.plasma-manager.packages.${pkgs.system}.default
|
freecad-wayland
|
||||||
|
freerdp
|
||||||
|
gurk-rs
|
||||||
jellyfin-media-player
|
jellyfin-media-player
|
||||||
# jellyfin-mpv-shim
|
|
||||||
kdePackages.plasma-vault
|
kdePackages.plasma-vault
|
||||||
keepassxc
|
keepassxc
|
||||||
leetcode-cli
|
leetcode-cli
|
||||||
|
man-pages
|
||||||
|
man-pages-posix
|
||||||
miniserve
|
miniserve
|
||||||
|
mousai
|
||||||
|
nixos-anywhere
|
||||||
|
nufmt
|
||||||
nushell
|
nushell
|
||||||
obs-studio
|
obs-studio
|
||||||
oculante
|
oculante
|
||||||
onlyoffice-bin
|
onlyoffice-bin
|
||||||
pandoc
|
pandoc
|
||||||
pipe-rename
|
pipe-rename
|
||||||
|
piper
|
||||||
prusa-slicer
|
prusa-slicer
|
||||||
qmk
|
qmk
|
||||||
qmk-udev-rules
|
qmk-udev-rules
|
||||||
|
|
@ -61,9 +58,10 @@
|
||||||
syncthingtray
|
syncthingtray
|
||||||
taskwarrior3
|
taskwarrior3
|
||||||
thunderbird
|
thunderbird
|
||||||
typst
|
|
||||||
# typst-fmt
|
|
||||||
tinymist
|
tinymist
|
||||||
|
toastify
|
||||||
|
typst
|
||||||
|
usbutils
|
||||||
vial
|
vial
|
||||||
wezterm
|
wezterm
|
||||||
wl-clipboard-rs
|
wl-clipboard-rs
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ in {
|
||||||
source = ./autostart;
|
source = ./autostart;
|
||||||
recursive = true;
|
recursive = true;
|
||||||
};
|
};
|
||||||
home.file.".config/direnv/lib/uv.sh".source = ./direnv/uv.sh;
|
home.file.".config/direnv/lib/".source = ./direnv;
|
||||||
home.file.".config/direnv/lib/devenv.sh".source = ./direnv/devenv.sh;
|
home.file.".config/direnv/lib/".recursive = true;
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
bacon = {
|
bacon = {
|
||||||
|
|
@ -115,7 +115,12 @@ in {
|
||||||
enable = true;
|
enable = true;
|
||||||
configFile.source = ./nushell/config.nu;
|
configFile.source = ./nushell/config.nu;
|
||||||
envFile.source = ./nushell/env.nu;
|
envFile.source = ./nushell/env.nu;
|
||||||
extraConfig = builtins.readFile ./nushell/stuff.nu;
|
# extraConfig = builtins.readFile ./nushell/stuff.nu;
|
||||||
|
extraConfig = lib.concatStrings (
|
||||||
|
map (
|
||||||
|
builtins.readFile builtins.readDir ./nushell/extra
|
||||||
|
)
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
ssh = {
|
ssh = {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,11 @@
|
||||||
settings = {
|
settings = {
|
||||||
theme = "gruvbox_dark_hard";
|
theme = "gruvbox_dark_hard";
|
||||||
editor = {
|
editor = {
|
||||||
|
auto-save = {
|
||||||
|
focus-lost = true;
|
||||||
|
after-delay.enable = true;
|
||||||
|
after-delay.timeout = 1000;
|
||||||
|
};
|
||||||
shell = ["nu" "--stdin" "-c"];
|
shell = ["nu" "--stdin" "-c"];
|
||||||
# rainbow-brackets = true;
|
# rainbow-brackets = true;
|
||||||
line-number = "relative";
|
line-number = "relative";
|
||||||
|
|
|
||||||
|
|
@ -82,3 +82,7 @@ $env.NU_PLUGIN_DIRS = [
|
||||||
$env.PATH = ($env.PATH | split row (char esep) | prepend '/home/tao/.cargo/bin')
|
$env.PATH = ($env.PATH | split row (char esep) | prepend '/home/tao/.cargo/bin')
|
||||||
|
|
||||||
$env.GOPATH = '/home/tao/.go'
|
$env.GOPATH = '/home/tao/.go'
|
||||||
|
|
||||||
|
# $env.CARAPACE_BRIDGES
|
||||||
|
mkdir ~/.cache/carapace
|
||||||
|
carapace _carapace nushell | save -f ~/.cache/carapace/init.nu
|
||||||
|
|
|
||||||
34
users/tao/nushell/extra/alias.nu
Normal file
34
users/tao/nushell/extra/alias.nu
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
alias xo = xdg-open
|
||||||
|
# alias h = hx (sk)
|
||||||
|
alias b = btm
|
||||||
|
alias cringe = sudo bootctl set-oneshot auto-windows
|
||||||
|
alias fetch = fastfetch
|
||||||
|
alias ff = firefox
|
||||||
|
alias pu = pueue
|
||||||
|
alias t = task
|
||||||
|
alias zl = zellij
|
||||||
|
alias snapper = snapper -c home
|
||||||
|
alias follow = readlink -f
|
||||||
|
alias la = ls -a
|
||||||
|
|
||||||
|
alias quiet = sudo ectool fanduty 42
|
||||||
|
alias loud = sudo ectool autofanctrl
|
||||||
|
|
||||||
|
alias cp-full = cp
|
||||||
|
alias cp = cp -prv
|
||||||
|
alias mv-full = mv
|
||||||
|
alias mv = mv -pv
|
||||||
|
|
||||||
|
alias j = jj
|
||||||
|
alias ja = jj log -r 'all()'
|
||||||
|
alias jc = jj desc
|
||||||
|
alias jd = jj diff
|
||||||
|
alias je = jj edit
|
||||||
|
alias jf = jj git fetch
|
||||||
|
alias jg = jj git clone --colocate
|
||||||
|
alias jm = jj bookmark set main
|
||||||
|
alias jp = jj git push
|
||||||
|
alias js = jj status
|
||||||
|
alias jw = jj workspace update-stale
|
||||||
|
|
||||||
|
|
||||||
37
users/tao/nushell/extra/nix.nu
Normal file
37
users/tao/nushell/extra/nix.nu
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
alias nd = nix develop
|
||||||
|
def ns [package] {
|
||||||
|
nix shell $"nixpkgs#($package)"
|
||||||
|
}
|
||||||
|
def nr [package] {
|
||||||
|
nix search nixpkgs $package
|
||||||
|
}
|
||||||
|
|
||||||
|
def rebuild --wrapped [subcommand, --builders: string, ...rest] {
|
||||||
|
if (open /etc/hostname --raw) == "NOlaptop\n" and ($builders != "") {
|
||||||
|
sudo nix store info --store ssh://nocomputer
|
||||||
|
}
|
||||||
|
if ($builders == "") {
|
||||||
|
sudo systemd-inhibit nice -n19 nixos-rebuild $subcommand --flake . --impure --verbose --builders ""
|
||||||
|
} else {
|
||||||
|
sudo systemd-inhibit nice -n19 nixos-rebuild $subcommand --flake . --impure --verbose ...$rest
|
||||||
|
}
|
||||||
|
toastify send rebuild done!
|
||||||
|
}
|
||||||
|
def post-rebuild [] {
|
||||||
|
rm -r ~/.config/helix/runtime/grammars/
|
||||||
|
hx --grammar fetch; hx --grammar build
|
||||||
|
rustup update
|
||||||
|
}
|
||||||
|
def bump --wrapped [...rest] {
|
||||||
|
cd /home/tao/projects/NOflake/
|
||||||
|
jj new -m "bump"
|
||||||
|
nix flake update
|
||||||
|
# rc2nix | save -f /home/tao/projects/NOflake/users/tao/plasma.nix;
|
||||||
|
# sudo nix store ping --store ssh://nocomputer
|
||||||
|
rebuild boot ...$rest
|
||||||
|
jj new
|
||||||
|
}
|
||||||
|
alias rb = rebuild boot
|
||||||
|
alias rs = rebuild switch
|
||||||
|
alias gc = nh clean all
|
||||||
|
|
||||||
62
users/tao/nushell/extra/stuff.nu
Normal file
62
users/tao/nushell/extra/stuff.nu
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
# task
|
||||||
|
|
||||||
|
def h [query?: path] {
|
||||||
|
(if ($query != null) {sk -1 -q ($query | path basename)} else {sk -1})
|
||||||
|
| complete
|
||||||
|
| if $in.exit_code == 0 {
|
||||||
|
$in.stdout | str trim | hx $in
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def --env c [path: path = "~"] {
|
||||||
|
cd $path
|
||||||
|
l
|
||||||
|
}
|
||||||
|
|
||||||
|
def l [
|
||||||
|
--all (-a)
|
||||||
|
--long (-l)
|
||||||
|
path: path = "."
|
||||||
|
] {
|
||||||
|
if $all and $long {
|
||||||
|
ls -la $path
|
||||||
|
} else if $all {
|
||||||
|
ls -a $path
|
||||||
|
} else if $long {
|
||||||
|
ls -l $path
|
||||||
|
} else {
|
||||||
|
ls $path
|
||||||
|
}
|
||||||
|
| sort-by type name -i -n
|
||||||
|
}
|
||||||
|
|
||||||
|
def srg [] {
|
||||||
|
sk --ansi -i -c 'rg --color=always --line-number "{}"'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def "config stuff" [] {
|
||||||
|
hx ~/projects/NOflake/users/tao/nushell/stuff.nu
|
||||||
|
}
|
||||||
|
def deluge-gtk [] {
|
||||||
|
tsr
|
||||||
|
deluge-gtk
|
||||||
|
}
|
||||||
|
alias deluge = deluge-gtk
|
||||||
|
def fixme [] {
|
||||||
|
rg TODO --json
|
||||||
|
| lines
|
||||||
|
| each {from json}
|
||||||
|
| where type == "match"
|
||||||
|
| get data
|
||||||
|
| flatten
|
||||||
|
| each {$"($in.text):($in.line_number)"}
|
||||||
|
| hx ...$in
|
||||||
|
}
|
||||||
|
source ~/.cache/starship/init.nu
|
||||||
|
# source ~/.cache/carapace/init.nu
|
||||||
|
source ~/.zoxide.nu
|
||||||
|
def --env z [path: string = "~"] {
|
||||||
|
zo $path
|
||||||
|
l
|
||||||
|
}
|
||||||
65
users/tao/nushell/extra/tailscale.nu
Normal file
65
users/tao/nushell/extra/tailscale.nu
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
def check-mullvad [] {
|
||||||
|
loop {
|
||||||
|
print "checking connection status"
|
||||||
|
http get https://am.i.mullvad.net/json
|
||||||
|
| if $in.mullvad_exit_ip == true {break} else {print $in}
|
||||||
|
sleep 1sec
|
||||||
|
}
|
||||||
|
}
|
||||||
|
def tse [exit_node: string = ""] {
|
||||||
|
if ($exit_node | is-empty) and (ps | find deluge | is-not-empty) {
|
||||||
|
return "stop summoning first!"
|
||||||
|
} else {
|
||||||
|
tailscale set --exit-node $exit_node
|
||||||
|
}
|
||||||
|
if ($exit_node | is-not-empty) {
|
||||||
|
check-mullvad
|
||||||
|
}
|
||||||
|
return "exit node set"
|
||||||
|
}
|
||||||
|
def tsp [] {
|
||||||
|
tailscale exit-node list
|
||||||
|
| split row "\n"
|
||||||
|
| each {str trim}
|
||||||
|
| filter {is-not-empty}
|
||||||
|
| skip 1
|
||||||
|
| last 19
|
||||||
|
| first 17
|
||||||
|
| split column -r '\s{2,}'
|
||||||
|
| reject column5 column3
|
||||||
|
| rename ip addr city
|
||||||
|
| par-each {
|
||||||
|
insert ping {
|
||||||
|
|row| $row.addr
|
||||||
|
| str replace "mullvad.ts.net" "relays.mullvad.net"
|
||||||
|
| ping -c5 -q $in
|
||||||
|
| split row "\n"
|
||||||
|
| last
|
||||||
|
| split column "/"
|
||||||
|
| get column6?
|
||||||
|
| get 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| sort-by ping -n -r
|
||||||
|
}
|
||||||
|
def tsr [] {
|
||||||
|
tailscale status --json
|
||||||
|
| from json
|
||||||
|
| get Peer
|
||||||
|
| transpose nodekey node
|
||||||
|
| get node
|
||||||
|
| filter {$in.Location?.Country == USA}
|
||||||
|
| get TailscaleIPs
|
||||||
|
| each {get 0}
|
||||||
|
| select (random int 0..($in | length))
|
||||||
|
| tse $in.0
|
||||||
|
# tailscale status
|
||||||
|
check-mullvad
|
||||||
|
}
|
||||||
|
alias ts = tailscale
|
||||||
|
alias tss = tailscale status
|
||||||
|
alias tsu = tailscale up
|
||||||
|
alias tsd = tailscale down
|
||||||
|
alias tsx = tailscale exit-node list
|
||||||
|
alias tsa = tailscale exit-node suggest
|
||||||
|
|
||||||
34
users/tao/nushell/extras/alias.nu
Normal file
34
users/tao/nushell/extras/alias.nu
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
alias xo = xdg-open
|
||||||
|
# alias h = hx (sk)
|
||||||
|
alias b = btm
|
||||||
|
alias cringe = sudo bootctl set-oneshot auto-windows
|
||||||
|
alias fetch = fastfetch
|
||||||
|
alias ff = firefox
|
||||||
|
alias pu = pueue
|
||||||
|
alias t = task
|
||||||
|
alias zl = zellij
|
||||||
|
alias snapper = snapper -c home
|
||||||
|
alias follow = readlink -f
|
||||||
|
alias la = ls -a
|
||||||
|
|
||||||
|
alias quiet = sudo ectool fanduty 42
|
||||||
|
alias loud = sudo ectool autofanctrl
|
||||||
|
|
||||||
|
alias cp-full = cp
|
||||||
|
alias cp = cp -prv
|
||||||
|
alias mv-full = mv
|
||||||
|
alias mv = mv -pv
|
||||||
|
|
||||||
|
alias j = jj
|
||||||
|
alias ja = jj log -r 'all()'
|
||||||
|
alias jc = jj desc
|
||||||
|
alias jd = jj diff
|
||||||
|
alias je = jj edit
|
||||||
|
alias jf = jj git fetch
|
||||||
|
alias jg = jj git clone --colocate
|
||||||
|
alias jm = jj bookmark set main
|
||||||
|
alias jp = jj git push
|
||||||
|
alias js = jj status
|
||||||
|
alias jw = jj workspace update-stale
|
||||||
|
|
||||||
|
|
||||||
37
users/tao/nushell/extras/nix.nu
Normal file
37
users/tao/nushell/extras/nix.nu
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
alias nd = nix develop
|
||||||
|
def ns [package] {
|
||||||
|
nix shell $"nixpkgs#($package)"
|
||||||
|
}
|
||||||
|
def nr [package] {
|
||||||
|
nix search nixpkgs $package
|
||||||
|
}
|
||||||
|
|
||||||
|
def rebuild --wrapped [subcommand, --builders: string, ...rest] {
|
||||||
|
if (open /etc/hostname --raw) == "NOlaptop\n" and ($builders != "") {
|
||||||
|
sudo nix store info --store ssh://nocomputer
|
||||||
|
}
|
||||||
|
if ($builders == "") {
|
||||||
|
sudo systemd-inhibit nice -n19 nixos-rebuild $subcommand --flake . --impure --verbose --builders ""
|
||||||
|
} else {
|
||||||
|
sudo systemd-inhibit nice -n19 nixos-rebuild $subcommand --flake . --impure --verbose ...$rest
|
||||||
|
}
|
||||||
|
toastify send rebuild done!
|
||||||
|
}
|
||||||
|
def post-rebuild [] {
|
||||||
|
rm -r ~/.config/helix/runtime/grammars/
|
||||||
|
hx --grammar fetch; hx --grammar build
|
||||||
|
rustup update
|
||||||
|
}
|
||||||
|
def bump --wrapped [...rest] {
|
||||||
|
cd /home/tao/projects/NOflake/
|
||||||
|
jj new -m "bump"
|
||||||
|
nix flake update
|
||||||
|
# rc2nix | save -f /home/tao/projects/NOflake/users/tao/plasma.nix;
|
||||||
|
# sudo nix store ping --store ssh://nocomputer
|
||||||
|
rebuild boot ...$rest
|
||||||
|
jj new
|
||||||
|
}
|
||||||
|
alias rb = rebuild boot
|
||||||
|
alias rs = rebuild switch
|
||||||
|
alias gc = nh clean all
|
||||||
|
|
||||||
62
users/tao/nushell/extras/stuff.nu
Normal file
62
users/tao/nushell/extras/stuff.nu
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
# task
|
||||||
|
|
||||||
|
def h [query?: path] {
|
||||||
|
(if ($query != null) {sk -1 -q ($query | path basename)} else {sk -1})
|
||||||
|
| complete
|
||||||
|
| if $in.exit_code == 0 {
|
||||||
|
$in.stdout | str trim | hx $in
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def --env c [path: path = "~"] {
|
||||||
|
cd $path
|
||||||
|
l
|
||||||
|
}
|
||||||
|
|
||||||
|
def l [
|
||||||
|
--all (-a)
|
||||||
|
--long (-l)
|
||||||
|
path: path = "."
|
||||||
|
] {
|
||||||
|
if $all and $long {
|
||||||
|
ls -la $path
|
||||||
|
} else if $all {
|
||||||
|
ls -a $path
|
||||||
|
} else if $long {
|
||||||
|
ls -l $path
|
||||||
|
} else {
|
||||||
|
ls $path
|
||||||
|
}
|
||||||
|
| sort-by type name -i -n
|
||||||
|
}
|
||||||
|
|
||||||
|
def srg [] {
|
||||||
|
sk --ansi -i -c 'rg --color=always --line-number "{}"'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def "config stuff" [] {
|
||||||
|
hx ~/projects/NOflake/users/tao/nushell/stuff.nu
|
||||||
|
}
|
||||||
|
def deluge-gtk [] {
|
||||||
|
tsr
|
||||||
|
deluge-gtk
|
||||||
|
}
|
||||||
|
alias deluge = deluge-gtk
|
||||||
|
def fixme [] {
|
||||||
|
rg TODO --json
|
||||||
|
| lines
|
||||||
|
| each {from json}
|
||||||
|
| where type == "match"
|
||||||
|
| get data
|
||||||
|
| flatten
|
||||||
|
| each {$"($in.text):($in.line_number)"}
|
||||||
|
| hx ...$in
|
||||||
|
}
|
||||||
|
source ~/.cache/starship/init.nu
|
||||||
|
# source ~/.cache/carapace/init.nu
|
||||||
|
source ~/.zoxide.nu
|
||||||
|
def --env z [path: string = "~"] {
|
||||||
|
zo $path
|
||||||
|
l
|
||||||
|
}
|
||||||
65
users/tao/nushell/extras/tailscale.nu
Normal file
65
users/tao/nushell/extras/tailscale.nu
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
def check-mullvad [] {
|
||||||
|
loop {
|
||||||
|
print "checking connection status"
|
||||||
|
http get https://am.i.mullvad.net/json
|
||||||
|
| if $in.mullvad_exit_ip == true {break} else {print $in}
|
||||||
|
sleep 1sec
|
||||||
|
}
|
||||||
|
}
|
||||||
|
def tse [exit_node: string = ""] {
|
||||||
|
if ($exit_node | is-empty) and (ps | find deluge | is-not-empty) {
|
||||||
|
return "stop summoning first!"
|
||||||
|
} else {
|
||||||
|
tailscale set --exit-node $exit_node
|
||||||
|
}
|
||||||
|
if ($exit_node | is-not-empty) {
|
||||||
|
check-mullvad
|
||||||
|
}
|
||||||
|
return "exit node set"
|
||||||
|
}
|
||||||
|
def tsp [] {
|
||||||
|
tailscale exit-node list
|
||||||
|
| split row "\n"
|
||||||
|
| each {str trim}
|
||||||
|
| filter {is-not-empty}
|
||||||
|
| skip 1
|
||||||
|
| last 19
|
||||||
|
| first 17
|
||||||
|
| split column -r '\s{2,}'
|
||||||
|
| reject column5 column3
|
||||||
|
| rename ip addr city
|
||||||
|
| par-each {
|
||||||
|
insert ping {
|
||||||
|
|row| $row.addr
|
||||||
|
| str replace "mullvad.ts.net" "relays.mullvad.net"
|
||||||
|
| ping -c5 -q $in
|
||||||
|
| split row "\n"
|
||||||
|
| last
|
||||||
|
| split column "/"
|
||||||
|
| get column6?
|
||||||
|
| get 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| sort-by ping -n -r
|
||||||
|
}
|
||||||
|
def tsr [] {
|
||||||
|
tailscale status --json
|
||||||
|
| from json
|
||||||
|
| get Peer
|
||||||
|
| transpose nodekey node
|
||||||
|
| get node
|
||||||
|
| filter {$in.Location?.Country == USA}
|
||||||
|
| get TailscaleIPs
|
||||||
|
| each {get 0}
|
||||||
|
| select (random int 0..($in | length))
|
||||||
|
| tse $in.0
|
||||||
|
# tailscale status
|
||||||
|
check-mullvad
|
||||||
|
}
|
||||||
|
alias ts = tailscale
|
||||||
|
alias tss = tailscale status
|
||||||
|
alias tsu = tailscale up
|
||||||
|
alias tsd = tailscale down
|
||||||
|
alias tsx = tailscale exit-node list
|
||||||
|
alias tsa = tailscale exit-node suggest
|
||||||
|
|
||||||
|
|
@ -1,189 +0,0 @@
|
||||||
# task
|
|
||||||
|
|
||||||
alias xo = xdg-open
|
|
||||||
# alias h = hx (sk)
|
|
||||||
alias b = btm
|
|
||||||
alias cringe = sudo bootctl set-oneshot auto-windows
|
|
||||||
alias fetch = fastfetch
|
|
||||||
alias ff = firefox
|
|
||||||
alias pu = pueue
|
|
||||||
alias t = task
|
|
||||||
alias zl = zellij
|
|
||||||
alias snapper = snapper -c home
|
|
||||||
alias follow = readlink -f
|
|
||||||
alias la = ls -a
|
|
||||||
|
|
||||||
alias quiet = sudo ectool fanduty 42
|
|
||||||
alias loud = sudo ectool autofanctrl
|
|
||||||
|
|
||||||
alias cp-full = cp
|
|
||||||
alias cp = cp -prv
|
|
||||||
alias mv-full = mv
|
|
||||||
alias mv = mv -pv
|
|
||||||
|
|
||||||
alias j = jj
|
|
||||||
alias ja = jj log -r 'all()'
|
|
||||||
alias jc = jj desc
|
|
||||||
alias jd = jj diff
|
|
||||||
alias je = jj edit
|
|
||||||
alias jf = jj git fetch
|
|
||||||
alias jg = jj git clone --colocate
|
|
||||||
alias jm = jj bookmark set main
|
|
||||||
alias jp = jj git push
|
|
||||||
alias js = jj status
|
|
||||||
alias jw = jj workspace update-stale
|
|
||||||
|
|
||||||
def h [] {
|
|
||||||
sk | complete |
|
|
||||||
if $in.exit_code == 0 {
|
|
||||||
$in.stdout | str trim | hx $in
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def --env c [path: path = "~"] {
|
|
||||||
cd $path
|
|
||||||
l
|
|
||||||
}
|
|
||||||
def l [
|
|
||||||
--all (-a)
|
|
||||||
--long (-l)
|
|
||||||
path: path = "."
|
|
||||||
] {
|
|
||||||
if $all and $long {
|
|
||||||
ls -la $path
|
|
||||||
} else if $all {
|
|
||||||
ls -a $path
|
|
||||||
} else if $long {
|
|
||||||
ls -l $path
|
|
||||||
} else {
|
|
||||||
ls $path
|
|
||||||
}
|
|
||||||
| sort-by type name -i -n
|
|
||||||
}
|
|
||||||
def srg [] {
|
|
||||||
sk --ansi -i -c 'rg --color=always --line-number "{}"'
|
|
||||||
}
|
|
||||||
alias nd = nix develop
|
|
||||||
def ns [package] {
|
|
||||||
nix shell $"nixpkgs#($package)"
|
|
||||||
}
|
|
||||||
def nr [package] {
|
|
||||||
nix search nixpkgs $package
|
|
||||||
}
|
|
||||||
def rebuild --wrapped [subcommand, --builders: string, ...rest] {
|
|
||||||
if (open /etc/hostname --raw) == "NOlaptop\n" and ($builders != "") {
|
|
||||||
sudo nix store info --store ssh://nocomputer
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($builders == "") {
|
|
||||||
sudo systemd-inhibit nice -n19 nixos-rebuild $subcommand --flake . --impure --verbose --builders ""
|
|
||||||
} else {
|
|
||||||
sudo systemd-inhibit nice -n19 nixos-rebuild $subcommand --flake . --impure --verbose ...$rest
|
|
||||||
}
|
|
||||||
toastify send rebuild done!
|
|
||||||
}
|
|
||||||
def post-rebuild [] {
|
|
||||||
rm -r ~/.config/helix/runtime/grammars/
|
|
||||||
hx --grammar fetch; hx --grammar build
|
|
||||||
rustup update
|
|
||||||
}
|
|
||||||
def bump --wrapped [...rest] {
|
|
||||||
cd /home/tao/projects/NOflake/
|
|
||||||
jj new -m "bump"
|
|
||||||
nix flake update
|
|
||||||
# rc2nix | save -f /home/tao/projects/NOflake/users/tao/plasma.nix;
|
|
||||||
# sudo nix store ping --store ssh://nocomputer
|
|
||||||
rebuild boot ...$rest
|
|
||||||
jj new
|
|
||||||
}
|
|
||||||
alias rb = rebuild boot
|
|
||||||
alias rs = rebuild switch
|
|
||||||
alias gc = nh clean all
|
|
||||||
def check-mullvad [] {
|
|
||||||
loop {
|
|
||||||
print "checking connection status"
|
|
||||||
http get https://am.i.mullvad.net/json
|
|
||||||
| if $in.mullvad_exit_ip == true {break} else {print $in}
|
|
||||||
sleep 1sec
|
|
||||||
}
|
|
||||||
}
|
|
||||||
def tse [exit_node: string = ""] {
|
|
||||||
if ($exit_node | is-empty) and (ps | find deluge | is-not-empty) {
|
|
||||||
return "stop summoning first!"
|
|
||||||
} else {
|
|
||||||
tailscale set --exit-node $exit_node
|
|
||||||
}
|
|
||||||
if ($exit_node | is-not-empty) {
|
|
||||||
check-mullvad
|
|
||||||
}
|
|
||||||
return "exit node set"
|
|
||||||
}
|
|
||||||
def tsp [] {
|
|
||||||
tailscale exit-node list
|
|
||||||
| split row "\n"
|
|
||||||
| each {str trim}
|
|
||||||
| filter {is-not-empty}
|
|
||||||
| skip 1
|
|
||||||
| last 19
|
|
||||||
| first 17
|
|
||||||
| split column -r '\s{2,}'
|
|
||||||
| reject column5 column3
|
|
||||||
| rename ip addr city
|
|
||||||
| par-each {
|
|
||||||
insert ping {
|
|
||||||
|row| $row.addr
|
|
||||||
| str replace "mullvad.ts.net" "relays.mullvad.net"
|
|
||||||
| ping -c5 -q $in
|
|
||||||
| split row "\n"
|
|
||||||
| last
|
|
||||||
| split column "/"
|
|
||||||
| get column6?
|
|
||||||
| get 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
| sort-by ping -n -r
|
|
||||||
}
|
|
||||||
def tsr [] {
|
|
||||||
tailscale status --json
|
|
||||||
| from json
|
|
||||||
| get Peer
|
|
||||||
| transpose nodekey node
|
|
||||||
| get node
|
|
||||||
| filter {$in.Location?.Country == USA}
|
|
||||||
| get TailscaleIPs
|
|
||||||
| each {get 0}
|
|
||||||
| select (random int 0..($in | length))
|
|
||||||
| tse $in.0
|
|
||||||
# tailscale status
|
|
||||||
check-mullvad
|
|
||||||
}
|
|
||||||
alias ts = tailscale
|
|
||||||
alias tss = tailscale status
|
|
||||||
alias tsu = tailscale up
|
|
||||||
alias tsd = tailscale down
|
|
||||||
alias tsx = tailscale exit-node list
|
|
||||||
alias tsa = tailscale exit-node suggest
|
|
||||||
def "config stuff" [] {
|
|
||||||
hx ~/projects/NOflake/users/tao/nushell/stuff.nu
|
|
||||||
}
|
|
||||||
def deluge-gtk [] {
|
|
||||||
tsr
|
|
||||||
deluge-gtk
|
|
||||||
}
|
|
||||||
alias deluge = deluge-gtk
|
|
||||||
def fixme [] {
|
|
||||||
rg TODO --json
|
|
||||||
| lines
|
|
||||||
| each {from json}
|
|
||||||
| where type == "match"
|
|
||||||
| get data
|
|
||||||
| flatten
|
|
||||||
| each {$"($in.text):($in.line_number)"}
|
|
||||||
| hx ...$in
|
|
||||||
}
|
|
||||||
source ~/.cache/starship/init.nu
|
|
||||||
source ~/.zoxide.nu
|
|
||||||
def --env z [path: string = "~"] {
|
|
||||||
zo $path
|
|
||||||
l
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue