Merged with zsh-config
This commit is contained in:
parent
a2c1656eb2
commit
5786492253
@ -9,12 +9,17 @@
|
||||
<nixpkgs/nixos/modules/services/hardware/sane_extra_backends/brscan4.nix>
|
||||
];
|
||||
|
||||
boot.initrd.luks.devices."luks-aaa4ee90-4242-428b-b086-9c33c03473fe".device = "/dev/disk/by-uuid/aaa4ee90-4242-428b-b086-9c33c03473fe";
|
||||
services.getty.autologinUser = "gregory";
|
||||
|
||||
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
nix.settings.experimental-features = [ "nix-command"];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
bc
|
||||
optipng
|
||||
#xdg-desktop-portal-wlr
|
||||
i3status
|
||||
@ -51,7 +56,6 @@
|
||||
tg
|
||||
gmic
|
||||
gimpPlugins.gmic
|
||||
geogebra6
|
||||
netpbm
|
||||
brscan5
|
||||
brscan4
|
||||
@ -113,7 +117,6 @@
|
||||
bluez-alsa
|
||||
cmus
|
||||
htop
|
||||
jetbrains.pycharm-community-bin
|
||||
picom
|
||||
linuxKernel.packages.linux_5_4.wireguard
|
||||
wireguard-tools
|
||||
@ -178,10 +181,11 @@
|
||||
|
||||
environment.etc."profile.local" = {
|
||||
text = ''
|
||||
export ZDOTDIR="$HOME/zsh-config"
|
||||
export EDITOR=vim
|
||||
'';
|
||||
};
|
||||
environment.etc."zshrc.local".text = builtins.readFile ./zshrc.local;
|
||||
environment.etc."my_zsh_utils.zsh".text = builtins.readFile ./my_zsh_utils.zsh;
|
||||
|
||||
services.dbus.enable = true;
|
||||
xdg.portal = {
|
||||
@ -243,13 +247,7 @@
|
||||
enable=true;
|
||||
exportConfiguration = true;
|
||||
};
|
||||
|
||||
services.displayManager.ly.enable = true;
|
||||
# deng I hate stupid NIXOS
|
||||
#services.displayManager.ly.settings = {
|
||||
# hide_borders = false;
|
||||
# animation = "colormix";
|
||||
#};
|
||||
services.xserver.displayManager.startx.enable = true;
|
||||
|
||||
users.extraGroups.vboxusers.members = [ "gregory" ];
|
||||
|
||||
|
||||
213
my_zsh_utils.zsh
Normal file
213
my_zsh_utils.zsh
Normal file
@ -0,0 +1,213 @@
|
||||
#!/bin/zsh
|
||||
|
||||
function homeREBUILD () {
|
||||
home-manager switch
|
||||
}
|
||||
|
||||
docx_to_pdf () {
|
||||
if [ -z "$1" ]; then
|
||||
echo "docx_to_pdf <document path>" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
libreoffice --headless --convert-to pdf "$1"
|
||||
}
|
||||
|
||||
download-audio(){
|
||||
if (( 2 <= $# && $# <= 3 )) ; then
|
||||
if (( $# > 2)); then
|
||||
local CODE=$3
|
||||
elif [ -z ${1##*soundcloud*} ]; then
|
||||
local CODE="hls_mp3_128"
|
||||
else
|
||||
local CODE="ba*"
|
||||
fi
|
||||
#yt-dlp -F "$1"
|
||||
echo "Using code $CODE"
|
||||
yt-dlp --extract-audio --format $CODE "$1" --audio-format mp3 --output "$2.%(ext)s" --verbose --no-playlist
|
||||
else
|
||||
echo "Wrong!!!!!"
|
||||
fi
|
||||
}
|
||||
|
||||
convert_cmus_to_lfsl() {
|
||||
local src_dir="$HOME/.config/cmus/playlists"
|
||||
local dst_dir="$HOME/Music/playlists"
|
||||
|
||||
mkdir -p "$dst_dir"
|
||||
|
||||
for src in "$src_dir"/*; do
|
||||
[ -f "$src" ] || continue
|
||||
local base=$(basename "$src")
|
||||
local out="$dst_dir/${base%.*}.lfsl"
|
||||
|
||||
printf 'Converting %s -> %s\n' "$src" "$out"
|
||||
# Empty or (re)create output file
|
||||
: > "$out"
|
||||
|
||||
while IFS= read -r line; do
|
||||
# Only process non-empty lines
|
||||
[ -z "$line" ] && continue
|
||||
|
||||
if [[ "$line" == "$HOME/Music/"* ]]; then
|
||||
# Strip the prefix and append
|
||||
echo "${line#"$HOME/Music/"}" >> "$out"
|
||||
else
|
||||
# Print warning for anything else
|
||||
printf 'Warning: skipping "%s" (not under $HOME/Music)\n' "$line" >&2
|
||||
fi
|
||||
done < "$src"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
download-video (){
|
||||
yt-dlp -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4" -o "%(title)s.mp4" $1
|
||||
}
|
||||
|
||||
export amsterdam_server_ip="77.238.231.168"
|
||||
export home_server_ip="81.200.28.227"
|
||||
|
||||
toamsterdamssh(){
|
||||
ssh -p 22 "root@${amsterdam_server_ip}"
|
||||
}
|
||||
|
||||
tomyservssh(){
|
||||
ssh -p 22 "root@${home_server_ip}"
|
||||
}
|
||||
|
||||
alias ls="ls -A --color=auto"
|
||||
alias tree="tree -a -C"
|
||||
alias grep="grep --colour=always"
|
||||
alias cp="cp -r"
|
||||
alias ascend="sudo -i zsh -l"
|
||||
alias pm="pulsemixer"
|
||||
alias ip="ip -color"
|
||||
alias sisyphus="mpv --loop-file=inf"
|
||||
alias COPY="xclip -i -f -selection primary | xclip -i -selection clipboard"
|
||||
alias vgmch="valgrind --tool=memcheck"
|
||||
alias vgmch-full="valgrind --leak-check=full --tool=memcheck"
|
||||
alias pero="sqlite3 -cmd '.explain on' -box"
|
||||
alias smatree="tree -I '.git|.idea|target|cmake-build-debug|.venv'"
|
||||
alias df="df -h"
|
||||
alias du="du -sh"
|
||||
|
||||
function ff (){
|
||||
if [ -n "$FF_MAIN_PROFILE" ]; then
|
||||
firefox -P "$FF_MAIN_PROFILE" $@
|
||||
else
|
||||
echo "Env var FF_MAIN_PROFILE not set"
|
||||
fi
|
||||
}
|
||||
|
||||
function bctl {
|
||||
sudo rfkill unblock all
|
||||
bluetoothctl
|
||||
}
|
||||
|
||||
function nixREPL {
|
||||
nix repl --expr 'let pkgs = import <nixpkgs> {}; lib = pkgs.lib; in pkgs'
|
||||
}
|
||||
|
||||
function nixosREBUILD {
|
||||
sudo nixos-rebuild switch
|
||||
}
|
||||
|
||||
function unblockall {
|
||||
sudo rfkill unblock all
|
||||
}
|
||||
|
||||
|
||||
function vibecheck { ping 8.8.8.8 }
|
||||
|
||||
function git-config-cred-store(){ git config credential.helper store }
|
||||
|
||||
function ffsilent { ffmpeg -i "$1" -c copy -an "${1%.*}-nosound.${1#*.}" }
|
||||
|
||||
function reSource { source /etc/zshrc.local }
|
||||
|
||||
function shitdown { sudo shutdown -h now }
|
||||
|
||||
function vpnup {
|
||||
if [ -n "$WG_VPN_NAME" ]; then
|
||||
wg-quick up "$WG_VPN_NAME"
|
||||
else
|
||||
echo "Env var WG_VPN_NAME is not set"
|
||||
fi
|
||||
}
|
||||
function vpndown {
|
||||
if [ -n "$WG_VPN_NAME" ]; then
|
||||
wg-quick down "$WG_VPN_NAME"
|
||||
else
|
||||
echo "Env var WG_VPN_NAME is not set"
|
||||
fi
|
||||
}
|
||||
|
||||
function lockscreen-xfcre { xfce4-screensaver-command -l }
|
||||
|
||||
function logout-xfce { xfce4-session-logout --logout }
|
||||
|
||||
function cmusclear {
|
||||
rm ~/.config/cmus/lib.pl
|
||||
}
|
||||
|
||||
# Whenever you feel bad, just open this pdf and your mood will be ruined completely
|
||||
function showmekeyboard {
|
||||
xkbprint :0 -color -nkg 2 -o - | ps2pdf - - | zathura -
|
||||
}
|
||||
|
||||
function tmuxzsh {
|
||||
tmux new-session zsh
|
||||
}
|
||||
|
||||
function cdnoita {
|
||||
cd ~/.local/share/Steam/steamapps/compatdata/881100/pfx/drive_c/users/steamuser/AppData/LocalLow/Nolla_Games_Noita/
|
||||
}
|
||||
|
||||
function start_recording_nosound {
|
||||
if [ -z "$1" ]; then
|
||||
echo "No output file specified"
|
||||
else
|
||||
ffmpeg -f x11grab -framerate 30 -i $DISPLAY -c:v libx264 -preset ultrafast -crf 18 "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
function wmtest-with-xephyr {
|
||||
xinit ~/.xinitrc -- /usr/bin/Xephyr :1 -ac -screen 1024x768 -br -noreset
|
||||
}
|
||||
|
||||
alias ru-setxkbmap="setxkbmap -layout \"us,ru\""
|
||||
|
||||
function get-real-x {
|
||||
setxkbmap -layout "us,ru" -option "grp:win_space_toggle"
|
||||
xset r rate 250 30
|
||||
xset b off
|
||||
xset s off -dpms
|
||||
}
|
||||
|
||||
function nixBUILDTHIS {
|
||||
nix-build -E 'with import <nixpkgs> {}; callPackage ./default.nix {}'
|
||||
}
|
||||
|
||||
function nixPREFETCHTHIS {
|
||||
nix-prefetch-url --unpack "file://$(realpath $1)" 2>&1 1>/dev/null | tail -n 1
|
||||
}
|
||||
|
||||
function win_r_compile {
|
||||
dmenuc.py ~/.config/suckless_desktop/win_r.dmenu ~/.config/suckless_desktop/win_r_out/
|
||||
}
|
||||
|
||||
alias cdslcfg="cd ~/.config/suckless_desktop"
|
||||
alias cdnocfg="cd /etc/nixos"
|
||||
alias cdhmcfg="cd ~/.config/home-manager"
|
||||
|
||||
function gitaddacommit {
|
||||
git status
|
||||
git add -A
|
||||
git commit -m "$1"
|
||||
git push
|
||||
}
|
||||
|
||||
if [ -z "$SSH_AUTH_SOCK" ]; then
|
||||
eval "$(ssh-agent -s)"
|
||||
fi
|
||||
|
||||
50
zshrc.local
Normal file
50
zshrc.local
Normal file
@ -0,0 +1,50 @@
|
||||
# Lines configured by zsh-newuser-install
|
||||
HISTFILE=${HOME}/.zsh_history
|
||||
HISTSIZE=1000
|
||||
SAVEHIST=1000
|
||||
unsetopt beep
|
||||
# End of lines configured by zsh-newuser-install
|
||||
bindkey -v
|
||||
|
||||
bindkey -M vicmd 'j' backward-char
|
||||
bindkey -M vicmd 'k' down-line-or-history
|
||||
bindkey -M vicmd 'l' up-line-or-history
|
||||
bindkey -M vicmd ';' forward-char
|
||||
|
||||
autoload -U compinit
|
||||
compinit
|
||||
_comp_options+=(globdots)
|
||||
setopt MENU_COMPLETE
|
||||
setopt AUTO_LIST
|
||||
|
||||
zmodload zsh/complist
|
||||
zstyle ':completion:*' menu select
|
||||
|
||||
function zsh-update-mode-color {
|
||||
if [[ ${KEYMAP} == vicmd ]]; then
|
||||
ZSH_MODE="NRM"
|
||||
ZSH_MODE_COLOR="%F{11}"
|
||||
else
|
||||
ZSH_MODE="INS"
|
||||
ZSH_MODE_COLOR="%F{cyan}"
|
||||
fi
|
||||
}
|
||||
|
||||
function zle-keymap-select {
|
||||
zsh-update-mode-color
|
||||
zle reset-prompt
|
||||
}
|
||||
|
||||
function zle-line-init {
|
||||
zsh-update-mode-color
|
||||
zle reset-prompt
|
||||
}
|
||||
|
||||
zle -N zle-keymap-select
|
||||
zle -N zle-line-init
|
||||
setopt prompt_subst
|
||||
PROMPT=$'${BEFORE_ZSH_PROMPT}%B%F{red}(\U0001D419)%f %F{green}%n%f %F{12}%~%f \${ZSH_MODE_COLOR}\${ZSH_MODE} $%f%b '
|
||||
|
||||
[ -f /etc/my_zsh_utils.zsh ] && source /etc/my_zsh_utils.zsh
|
||||
[ -f "${HOME}/.zshrc" ] && source "${HOME}/.zshrc"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user