Files
home-cluster/.taskfiles/Workstation/Taskfile.yaml
T

78 lines
2.9 KiB
YAML

---
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: '3'
vars:
ARCHFILE: '{{.ROOT_DIR}}/.taskfiles/Workstation/Archfile'
BREWFILE: '{{.ROOT_DIR}}/.taskfiles/Workstation/Brewfile'
GENERIC_BIN_DIR: '{{.ROOT_DIR}}/.bin'
PIP_REQUIREMENTS_FILE: '{{.ROOT_DIR}}/requirements.txt'
PYTHON_BIN: python3
tasks:
arch:
desc: Install Arch workstation dependencies with Paru Or Yay
cmd: '{{.PKGMGR}} -Syu --needed --noconfirm --noprogressbar $(cat {{.ARCHFILE}} | xargs)'
vars:
PKGMGR:
sh: command -v yay || command -v paru
preconditions:
- msg: Missing Archfile
sh: test -f {{.ARCHFILE}}
brew:
desc: Install workstation dependencies with Brew
cmd: brew bundle --file {{.BREWFILE}}
preconditions:
- msg: Missing Homebrew
sh: command -v brew
- msg: Missing Brewfile
sh: test -f {{.BREWFILE}}
direnv:
desc: Run direnv hooks
cmd: direnv allow .
status:
- '[[ $(direnv status --json | jq ".state.foundRC.allowed") == 0 ]]'
- '[[ $(direnv status --json | jq ".state.loadedRC.allowed") == 0 ]]'
generic-linux:
desc: Try to install CLI tools into the projects .bin directory
dir: '{{.GENERIC_BIN_DIR}}'
platforms: ['linux/amd64', 'linux/arm64']
cmds:
- for:
- budimanjojo/talhelper?as=talhelper&type=script
- cloudflare/cloudflared?as=cloudflared&type=script
- FiloSottile/age?as=age&type=script
- fluxcd/flux2?as=flux&type=script
- getsops/sops?as=sops&type=script
- helmfile/helmfile?as=helmfile&type=script
- jqlang/jq?as=jq&type=script
- kubernetes-sigs/kustomize?as=kustomize&type=script
- siderolabs/talos?as=talosctl&type=script
- yannh/kubeconform?as=kubeconform&type=script
- mikefarah/yq?as=yq&type=script
cmd: curl -fsSL "https://i.jpillora.com/{{.ITEM}}" | bash
- cmd: curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
platforms: ['linux/amd64']
- cmd: curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl"
platforms: ['linux/arm64']
- cmd: chmod +x kubectl
- cmd: curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | USE_SUDO="false" HELM_INSTALL_DIR="." bash
venv:
desc: Set up virtual environment
cmds:
- '{{.PYTHON_BIN}} -m venv {{.VIRTUAL_ENV}}'
- '{{.VIRTUAL_ENV}}/bin/python3 -m pip install --upgrade pip setuptools wheel'
- '{{.VIRTUAL_ENV}}/bin/python3 -m pip install --upgrade --requirement "{{.PIP_REQUIREMENTS_FILE}}"'
sources:
- '{{.PIP_REQUIREMENTS_FILE}}'
generates:
- '{{.VIRTUAL_ENV}}/pyvenv.cfg'
preconditions:
- msg: Missing Pip requirements file
sh: test -f {{.PIP_REQUIREMENTS_FILE}}