diff --git a/justfile b/justfile index a5b9d93..402fd55 100644 --- a/justfile +++ b/justfile @@ -1,4 +1,6 @@ ## Justfile (https://github.com/casey/justfile) +## +## Helps automate various homelab tasks. distro := `grep -G "\bID\b" /etc/os-release | awk -F= '{print $2}'` release := `grep "VERSION_CODENAME" /etc/os-release | awk -F= '{print $2}'` @@ -7,11 +9,12 @@ run_user := env_var("USER") default: common common: - sudo apt update - sudo apt dist-upgrade -y - sudo apt install -y \ + sudo apt update -t {{release}}-backports + sudo apt dist-upgrade -y -t {{release}}-backports + sudo apt install -y -t {{release}}-backports \ apt-file \ apt-listchanges \ + apt-transport-https \ apt-utils \ atop \ autoconf \ @@ -23,7 +26,6 @@ common: firewalld \ git \ htop \ - httpie \ ifplugd \ iotop \ less \ @@ -31,6 +33,7 @@ common: lynis \ man-db \ manpages \ + neovim \ nfs-common \ nmon \ pipx \ @@ -39,10 +42,22 @@ common: rclone \ rsync \ unattended-upgrades \ - vim \ wget \ zsh sudo systemctl enable man-db.timer + pipx install glances + pipx install gmcapsule + +copy: + find "${PWD}/bin" -maxdepth 1 -type f -exec sudo cp -fv {} /usr/local/bin \; + find "${PWD}/systemd/system" -maxdepth 1 -type f -exec sudo cp -fv {} /etc/systemd/system \; + mkdir -p "${HOME}/.config/systemd/user" + find "${PWD}/systemd/user" -maxdepth 1 -type f -exec cp -fv {} "${HOME}/.config/systemd/user" \; + +cleanup: + sudo find /usr/local/bin -type f -delete + for item in "$(ls "${PWD}/systemd/system")"; do sudo rm -fv "/etc/systemd/system/$item"; done + for item in "$(ls "${PWD}/systemd/user")"; do rm -fv "${HOME}/.config/systemd/user/$item"; done caddy-install: sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl @@ -51,33 +66,15 @@ caddy-install: sudo apt update sudo apt install caddy -archivebox-install: - sudo apt install -y pipx python3-dev python3-pip nodejs npm curl wget git ripgrep - pipx install archivebox - pipx install yt-dlp - pipx install playwright - playwright install --with-deps chromium - -archivebox-init: - cd {{archivebox_data}} && archivebox init --setup - -archivebox-setup: - cd {{archivebox_data}} && archivebox setup - thelounge-install: curl -s https://api.github.com/repos/thelounge/thelounge-deb/releases/latest | grep "browser_download_url.*deb" | cut -d : -f 2,3 | tr -d \" | wget -qi - sudo apt install -y ./thelounge*.deb + rm -fv ./thelounge*.deb tailscale-install: curl -fsSL https://tailscale.com/install.sh | sh sudo tailscale up -qbt-install: - curl -1sLf 'https://dl.cloudsmith.io/public/qbittorrent-cli/qbittorrent-cli/gpg.F8756541ADDA2B7D.key' | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/qbittorrent-cli.gpg - sudo wget https://repos.fedarovich.com/{{distro}}/{{release}}/qbittorrent-cli.list -O /etc/apt/sources.list.d/qbittorrent-cli.list - sudo apt update - sudo apt install -y qbittorrent-cli - scihub-setup: mkdir ~/scihub-torrent-urls lynx -dump -nonumbers -listonly=on https://libgen.rs/repository_torrent/ | grep "\.torrent" | tee ~/scihub-torrent-urls/urls.txt @@ -98,3 +95,43 @@ docker-install: sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose docker-compose-plugin sudo systemctl enable --now docker.service sudo usermod -aG docker {{run_user}} + +rustup: + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + +rustup-root: + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sudo sh + +rust-tools: + source "${HOME}/.cargo/env" + cargo install cargo-binstall + for pkg in "arp-scan" "bandwhich" "bat" "diskonaut" "du-dust" "fblog" "fd" "hyperfine" "procs" "ripgrep" "skim"; do \ + cargo-binstall -y "$pkg"; \ + done + +rust-tools-root: + sudo /root/.cargo/bin/cargo install cargo-binstall + for pkg in "arp-scan" "bandwhich" "bat" "diskonaut" "du-dust" "fblog" "fd-find" "hyperfine" "procs" "ripgrep" "skim"; do \ + sudo /root/.cargo/bin/cargo-binstall -y "$pkg"; \ + done + echo 'source "${HOME}/.cargo/env"' | sudo tee -a /root/.bashrc + echo 'source "${HOME}/.cargo/env"' | sudo tee -a /root/.zshrc + +neovim: + sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \ + https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' + + mkdir -p "${HOME}/.config/nvim" + wget https://cdn.hyperreal.coffee/init.vim -O "${HOME}/.config/nvim/init.vim" + +neovim-root: + sudo sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \ + https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' + + sudo mkdir -p "${HOME}/.config/nvim" + sudo wget https://cdn.hyperreal.coffee/init.vim -O "${HOME}/.config/nvim/init.vim" + +zshrc: + sudo wget https://cdn.hyperreal.coffee/zshrc -O /etc/zsh/zshrc + touch "${HOME}/.zshrc" + sudo touch /root/.zshrc