-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
56 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,80 @@ | ||
{ pkgs, lib, ... }: | ||
|
||
# FAQ | ||
# | ||
# A. How to make executable? .text= makes syms, that links to non executable file | ||
# Q. https://github.com/nix-community/home-manager/blob/15043a65915bcc16ad207d65b202659e4988066b/modules/xsession.nix#L195C1-L197 | ||
|
||
# - 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/add_nix_channels".source = ../home/.local/share/homemade/bin/add_nix_channels.bash; | ||
|
||
xdg.dataFile."homemade/bin/bench_shells".text = '' | ||
#!/usr/bin/env bash | ||
xdg.dataFile."homemade/bin/bench_shells" = { | ||
executable = true; | ||
text = '' | ||
#!/usr/bin/env bash | ||
set -euxo pipefail | ||
set -euxo pipefail | ||
# ~ my feeling ~ | ||
# 50ms : blazing fast! | ||
# 110ms : acceptable | ||
# 150ms : slow | ||
# 200ms : 1980s? | ||
# 300ms : much slow! | ||
# ~ my feeling ~ | ||
# 50ms : blazing fast! | ||
# 110ms : acceptable | ||
# 150ms : slow | ||
# 200ms : 1980s? | ||
# 300ms : much slow! | ||
# zsh should be first, because it often makes much slower with the completion | ||
${lib.getExe pkgs.hyperfine} --warmup 1 '${lib.getExe pkgs.zsh} --interactive -c exit' | ||
# zsh should be first, because it often makes much slower with the completion | ||
${lib.getExe pkgs.hyperfine} --warmup 1 '${lib.getExe pkgs.zsh} --interactive -c exit' | ||
${lib.getExe pkgs.hyperfine} --warmup 1 '${lib.getExe pkgs.bashInteractive} -i -c exit' | ||
${lib.getExe pkgs.hyperfine} --warmup 1 '${lib.getExe pkgs.fish} --interactive --command exit' | ||
''; | ||
${lib.getExe pkgs.hyperfine} --warmup 1 '${lib.getExe pkgs.bashInteractive} -i -c exit' | ||
${lib.getExe pkgs.hyperfine} --warmup 1 '${lib.getExe pkgs.fish} --interactive --command exit' | ||
''; | ||
}; | ||
|
||
xdg.dataFile."homemade/bin/updeps".text = '' | ||
#!/usr/bin/env bash | ||
xdg.dataFile."homemade/bin/updeps" = { | ||
executable = true; | ||
text = '' | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
set -euo pipefail | ||
case ''${OSTYPE} in | ||
linux*) | ||
sudo apt update --yes && sudo apt upgrade --yes | ||
;; | ||
darwin*) | ||
softwareupdate --install --recommended | ||
;; | ||
esac | ||
case ''${OSTYPE} in | ||
linux*) | ||
sudo apt update --yes && sudo apt upgrade --yes | ||
;; | ||
darwin*) | ||
softwareupdate --install --recommended | ||
;; | ||
esac | ||
nix-channel --update | ||
nix-channel --update | ||
${lib.getExe pkgs.rtx} plugins update | ||
''; | ||
${lib.getExe pkgs.rtx} plugins update | ||
''; | ||
}; | ||
|
||
xdg.dataFile."homemade/bin/la".text = '' | ||
#!/usr/bin/env bash | ||
xdg.dataFile."homemade/bin/la" = { | ||
executable = true; | ||
text = '' | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
set -euo pipefail | ||
${lib.getExe pkgs.exa} --long --all --group-directories-first "$@" | ||
''; | ||
${lib.getExe pkgs.exa} --long --all --group-directories-first "$@" | ||
''; | ||
}; | ||
|
||
xdg.dataFile."homemade/bin/zj".text = '' | ||
#!/usr/bin/env bash | ||
xdg.dataFile."homemade/bin/zj" = { | ||
executable = true; | ||
text = '' | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
set -euo pipefail | ||
name="$(${lib.getBin pkgs.coreutils}/bin/basename "$PWD")" | ||
name="$(${lib.getBin pkgs.coreutils}/bin/basename "$PWD")" | ||
${lib.getExe pkgs.zellij} attach "$name" || ${lib.getExe pkgs.zellij} --session "$name" | ||
''; | ||
${lib.getExe pkgs.zellij} attach "$name" || ${lib.getExe pkgs.zellij} --session "$name" | ||
''; | ||
}; | ||
} |