apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  name: execute-in-vm-with-ssh-taskrun-clean
spec:
  serviceAccountName: execute-in-vm-task
  taskRef:
    kind: ClusterTask
    name: execute-in-vm
  params:
  - name: vmName
    value: vm-guix-datavolume
  - name: secretName
    value: ssh-secret
  - name: script
    value: |
      #!/usr/bin/env bash
      set -o nounset -o errexit -o pipefail -o xtrace
      mkdir -p "${HOME}/.local/share"
      guix install git
      if [[ -e "${HOME}/.local/share/chezmoi" ]]
      then
          :
      else
          git clone https://gitlab.com/wigust/dotfiles "${HOME}/.local/share/chezmoi"
      fi
      cd "${HOME}/.local/share/chezmoi" || exit 1
      git pull --rebase origin master
      sudo -i guix pull --channels="${PWD}/dotfiles/channels-current-local-file.scm"
      sudo -i guix system reconfigure --load-path="${PWD}/dotfiles/guixsd/modules" --allow-downgrades "${PWD}/dotfiles/guixsd/vm-guix-datavolume.scm"
