Skip to content

Commit

Permalink
Extract non core rc functions to another bash
Browse files Browse the repository at this point in the history
Prepare #199, #201
  • Loading branch information
kachick committed Jul 29, 2023
1 parent 11588f4 commit 07099c9
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 34 deletions.
10 changes: 10 additions & 0 deletions home/.config/home-manager/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@
irb-power_assert
'';

# - Tiny tools by me, they may be rewritten with another language.
# - Keep *.bash in shellscript naming in this repo for maintainability, the extname should be trimmed in the symlinks
xdg.dataFile."homemade/bin/bench_shells".source = ../../../home/.local/share/homemade/bin/bench_shells.bash;
xdg.dataFile."homemade/bin/updeps".source = ../../../home/.local/share/homemade/bin/updeps.bash;
home.sessionPath = [
"${config.xdg.dataHome}/homemade/bin"
];

home.packages = [
pkgs.dprint
pkgs.deno
Expand Down Expand Up @@ -221,3 +229,5 @@
];
}



34 changes: 0 additions & 34 deletions home/.config/zsh/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -71,40 +71,6 @@ _compinit_with_interval() {
}
_compinit_with_interval

update_tools() {
case ${OSTYPE} in
linux*)
sudo apt update --yes && sudo apt upgrade --yes
;;
darwin*)
softwareupdate --install --recommended
;;
esac

nix-channel --update
home-manager switch

if type 'sheldon' > /dev/null; then
sheldon lock --update
fi
if command -v rtx; then
rtx self-update
rtx plugins update
fi
}

# Keep under 120ms...!
bench_zsh() {
hyperfine 'zsh -i -c exit'
}

bench_shells() {
bench_zsh
# Really having same options as zsh...?
hyperfine 'bash -i -c exit'
hyperfine 'nu -i -c exit'
}

case ${OSTYPE} in
darwin*)
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
Expand Down
12 changes: 12 additions & 0 deletions home/.local/share/homemade/bin/bench_shells.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

# ~ my feeling ~
# 50ms : blazing fast!
# 120ms : acceptable
# 200ms : 1980s?
# 300ms : slow!

hyperfine 'zsh -i -c exit'
# Really having same options as zsh...?
hyperfine 'bash -i -c exit'
hyperfine 'nu -i -c exit'
21 changes: 21 additions & 0 deletions home/.local/share/homemade/bin/updeps.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

case ${OSTYPE} in
linux*)
sudo apt update --yes && sudo apt upgrade --yes
;;
darwin*)
softwareupdate --install --recommended
;;
esac

nix-channel --update
home-manager switch

if type 'sheldon' >/dev/null; then
sheldon lock --update
fi
if command -v rtx; then
rtx self-update
rtx plugins update
fi

0 comments on commit 07099c9

Please sign in to comment.