#!/usr/bin/env fish function update-homes -d "Update homes configuration" argparse 'h/help' 'g/git' 'd/desktop' 'r/root' 'R/remove' 'i/install' 'D/fix-debian' -- $argv set -f homes_path ~/homes set -f homes_private_path ~/homes-private if set -q HOMES_PATH set -f homes_path $HOMES_PATH end if set -q HOMES_PRIVATE_PATH set -f homes_private_path $HOMES_PRIVATE_PATH end if not test -d $homes_path echo (set_color c94f6d)"*** ERROR ***"(set_color normal) echo "*** $homes_path does not exists" return end if not test -n homes_path echo (set_color c94f6d)"*** ERROR ***"(set_color normal) echo "*** HOMES_PATH variable is empty" return end if not test -n homes_private_path echo (set_color c94f6d)"*** ERROR ***"(set_color normal) echo "*** HOMES_PRIVATE_PATH is empty, unset or change it" return end if not test -d $homes_private_path echo (set_color f4a261)"*** WARNING ***"(set_color normal) echo "*** $homes_private_path does not exist" echo echo end if not functions -q update-homes-secrets echo (set_color f4a261)"*** WARNING ***"(set_color normal) echo "*** update-homes-secrets is not defined" echo echo end if set -q _flag_help echo "Update home's configuration" echo echo "You need to have homes and homes-private in your home directory." echo "This function launch the two scripts to update your conf." echo echo " -g --git" echo " Pull-rebase before launch script" echo echo " -d --desktop" echo " Update desktop part" echo echo " -r --root" echo " Update root part" echo echo " -R --remove" echo " Remove old configuration" echo echo " -i --install" echo " Install user packages and softwares" echo echo " -D --fix-debian" echo " Install missing packages in debian into user path" echo echo " -h --help" echo " Show this screen" return end if set -q _flag_fix_debian echo echo echo (set_color 81b29a)"*** Install user softwares ***"(set_color normal) echo echo (set_color 719cd6)"*** Install nvimpager ***"(set_color normal) echo mkdir -p ~/.cache rm -rf ~/.cache/nvimpager-git git clone --depth 1 https://github.com/lucc/nvimpager ~/.cache/nvimpager-git pushd ~/.cache/nvimpager-git make PREFIX=$HOME/.local install popd rm -rf ~/.cache/nvimpager-git echo echo echo (set_color 719cd6)"*** Install virtualfish ***"(set_color normal) echo pip install --user --upgrade --break-system-packages virtualfish echo echo echo (set_color 719cd6)"*** Install pyright ***"(set_color normal) echo pip install --user --upgrade --break-system-packages -U pyright echo echo echo (set_color 719cd6)"*** Install broot ***"(set_color normal) echo cargo install broot echo echo echo (set_color 719cd6)"*** Install starship ***"(set_color normal) echo cargo install starship echo echo echo (set_color 719cd6)"*** Install onefetch ***"(set_color normal) echo cargo install onefetch end if set -q _flag_desktop && set -q _flag_fix_debian echo echo echo (set_color 719cd6)"*** Install lazydocker ***"(set_color normal) echo go install github.com/jesseduffield/lazydocker@latest echo echo echo (set_color 719cd6)"*** Install lazygit ***"(set_color normal) echo go install github.com/jesseduffield/lazygit@latest echo echo echo (set_color 719cd6)"*** Install bluetuith ***"(set_color normal) go install github.com/darkhz/bluetuith@latest echo echo echo (set_color 719cd6)"*** Install pms ***"(set_color normal) echo go install github.com/ambientsound/pms@latest echo echo echo (set_color 719cd6)"*** Install pastel ***"(set_color normal) echo cargo install pastel echo echo echo (set_color 719cd6)"*** Install cargo-espflash, espflash and espup ***"(set_color normal) echo cargo install espflash espup cargo-espflash echo echo echo (set_color 719cd6)"*** Install wthrr ***"(set_color normal) echo cargo install wthrr echo echo echo (set_color 719cd6)"*** Install offpunk ***"(set_color normal) echo pip install --user --upgrade --break-system-packages -U offpunk echo echo echo (set_color 719cd6)"*** Install poezio-omemo and epy ***"(set_color normal) echo pip install --user --upgrade --break-system-packages -U poezio-omemo epy-reader echo echo echo (set_color 719cd6)"*** Install todoman ***"(set_color normal) echo pip install --user --upgrade --break-system-packages -U todoman click-repl echo echo echo (set_color 719cd6)"*** Install poezio plugins ***"(set_color normal) echo rm -rf ~/.local/share/poezio/plugins mkdir -p ~/.local/share/poezio/logs set -l poezio_version $(poezio --version | cut -d " " -f 2) rm -rf ~/.cache/poezio-git git clone --depth 1 -b $poezio_version https://codeberg.org/poezio/poezio ~/.cache/poezio-git pushd ~/.cache/poezio-git popd cp -r ~/.cache/poezio-git/plugins ~/.local/share/poezio rm -rf ~/.cache/poezio-git end if set -q _flag_install echo echo echo (set_color 719cd6)"*** Install virtualfish ***"(set_color normal) echo vf install auto_activation compat_aliases global_requirements projects environment echo echo echo (set_color 719cd6)"*** Install fundle plugins ***"(set_color normal) echo fundle install fundle update echo echo echo (set_color 719cd6)"*** Install pygments style ***"(set_color normal) echo pip install "git+https://procrastinator.nerv-project.eu/kujiu/pygments_nightfox_style" --user --break-system-packages echo echo echo (set_color 719cd6)"*** Install xonsh plugins ***"(set_color normal) echo echo "xpip install -U xontrib-commands xontrib-gitinfo \ xontrib-broot xontrib-hist-navigator xontrib-prompt-vi-mode \ xontrib-vox xontrib-abbrevs xontrib-argcomplete xontrib-django \ xonsh-docker-tabcomplete xontrib-fish-completer xontrib-jedi\ xontrib-makefile-complete --break-system-packages; exit(1)" | xonsh echo echo echo (set_color 719cd6)"*** Install hgrep ***"(set_color normal) echo cargo install hgrep end if set -q _flag_remove echo (set_color 81b29a)"**** Remove old config ***"(set_color normal) # Remove zsh rm ~/.zcompdump rm -rf ~/.zsh* ~/.local/share/zsh # Remove old tmux files rm -f ~/.tmux.conf ~/.tmux-theme rm -rf ~/.config/aerc rm -rf ~/.config/fish rm -rf ~/.config/khal rm -rf ~/.config/khard rm -rf ~/.config/lvim rm -rf ~/.config/neomutt rm -rf ~/.config/newsboat rm -rf ~/.config/nvim rm -rf ~/.config/poezio rm -rf ~/.config/tmux rm -rf ~/.config/tmuxinator rm -rf ~/.config/toot rm -rf ~/.config/vdirsyncer rm -rf ~/.local/share/json-fortune rm ~/.fortunes.json rm ~/.wikiquote-sources.json end if set -q _flag_git echo echo echo (set_color 81b29a)"*** Update homes configuration directories ***"(set_color normal) echo pushd $homes_path gitpr popd if test -d $homes_private_path pushd $homes_private_path gitpr popd end end echo echo echo (set_color 81b29a)"*** Synchronize files ***"(set_color normal) echo echo echo (set_color 719cd6)"*** Copying common part ***"(set_color normal) echo if test -d $homes_path/common pushd $homes_path rsync --exclude=".*.swp" -av ./common/ ~/ popd set_nightfox_vars sed -i "s:REPLACEHOME:$HOME:g" ~/.config/nvim/init.lua sed -i "s:REPLACEHOME:$HOME:g" ~/.config/nvimpager/init.lua sed -i "s:REPLACEHOME:$HOME:g" ~/.config/lvim/config.lua end if test -d $homes_private_path/common pushd $homes_private_path rsync --exclude=".*.swp" -av ./common/ ~/ popd end if set -q _flag_install echo echo echo (set_color 719cd6)"*** Install json-fortune deps ***"(set_color normal) echo pip install --user --upgrade --break-system-packages wikiquote if not test -f ~/.local/share/json-fortune/fortunes.json update-quotes end end if set -q _flag_root echo echo echo (set_color 719cd6)"*** Copying root part ***"(set_color normal) echo if test -d $homes_path/root pushd $homes_path rsync --exclude=".*.swp" -av ./root/ ~/ popd end if test -d $homes_private_path/root pushd $homes_private_path rsync --exclude=".*.swp" -av ./root/ ~/ popd end end if set -q _flag_desktop mkdir -p ~/.local/share/poezio2/logs echo echo echo (set_color 719cd6)"*** Copying desktop part ***"(set_color normal) echo if test -d $homes_path/desktop pushd $homes_path rsync --exclude=".*.swp" -av ./desktop/ ~/ popd end if test -d $homes_private_path/desktop pushd $homes_private_path rsync --exclude=".*.swp" -av ./desktop/ ~/ popd end end if functions -q update-homes-secrets update-homes-secrets $_flag_desktop $_flag_root $_flag_fix_debian end end