config:
  backup: true
  create: true
  dotpath: dotfiles
variables:
  ageidentity: "{{@@ env['HOME'] @@}}/.age/phg-age-dotfiles"
  ageidentity_pub: '{{@@ ageidentity@@}}.pub'
  SHELL_ERR_MESSAGE: \033[41;30m
  SHELL_RESET_COLOR: \033[0m
trans_install:
  _decrypt: |
    [[ -f {{@@ ageidentity @@}} ]] && age --decrypt -i {{@@ ageidentity @@}} -o {1} {0} || ([[ ! -f {{@@ _dotfile_abs_dst @@}} ]] && (echo "{{@@ SHELL_ERR_MESSAGE @@}}Missing age identity file {{@@ ageidentity @@}}, cannot decrypt {0}, creating empty file instead{{@@ SHELL_RESET_COLOR @@}}"; echo "" > {1}) || (echo "{{@@ SHELL_ERR_MESSAGE @@}}Missing age identity file {{@@ ageidentity @@}}, cannot decrypt {0}{{@@ SHELL_RESET_COLOR @@}}"; cp {{@@ _dotfile_abs_dst @@}} {1}))
trans_update:
  _encrypt: |
    [[ -f {{@@ ageidentity_pub @@}} ]] && cat {0} | age -a -R {{@@ ageidentity_pub @@}} > {1} || echo "{{@@ SHELL_ERR_MESSAGE @@}}Missing age identity file {{@@ ageidentity_pub @@}}, cannot encrypt {0}{{@@ SHELL_RESET_COLOR @@}}"
actions:
  oh-my-zsh: |
    [[ ! -d ${{HOME}}/.oh-my-zsh ]] && sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" "" --unattended || echo "do nothing" >/dev/null
    [[ -f ${{HOME}}/.zshrc.pre-oh-my-zsh ]] && rm ${{HOME}}/.zshrc && mv ${{HOME}}/.zshrc.pre-oh-my-zsh ${{HOME}}/.zshrc || echo "do nothing" >/dev/null
    [[ ! -d ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/plugins ]] && mkdir -p ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/plugins || echo "do nothing" >/dev/null
    [[ ! -d ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/plugins/custom-completions ]] && mkdir -p ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/plugins/custom-completions || echo "do nothing" >/dev/null
    [[ ! -f ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/plugins/custom-completions/_diskutil.zsh ]] && curl -o ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/plugins/custom-completions/_diskutil.zsh https://github.com/zchee/zsh-completions/blob/main/src/macOS/_diskutil || echo "do nothing" >/dev/null
    [[ ! -f ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/plugins/custom-completions/_dotdrop-completion.zsh ]] && curl -o ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/plugins/custom-completions/_dotdrop-completion.zsh https://raw.githubusercontent.com/deadc0de6/dotdrop/master/completion/_dotdrop-completion.zsh || echo "do nothing" >/dev/null
    [[ ! -f ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/plugins/custom-completions/_fabric ]] && curl -sSLo ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/plugins/custom-completions/_fabric https://raw.githubusercontent.com/danielmiessler/fabric/refs/heads/main/completions/_fabric || echo "do nothing" >/dev/null
    [[ ! -d ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/plugins/fzf-tab-completion ]] && git clone https://github.com/lincheney/fzf-tab-completion.git ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/plugins/fzf-tab-completion || echo "do nothing" >/dev/null
    [[ ! -d ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/plugins/nix-zsh-completions ]] && git clone https://github.com/nix-community/nix-zsh-completions.git ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/plugins/nix-zsh-completions || echo "do nothing" >/dev/null
    [[ ! -d ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/plugins/zsh-autosuggestions ]] && git clone https://github.com/zsh-users/zsh-autosuggestions ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/plugins/zsh-autosuggestions || echo "do nothing" >/dev/null
    [[ ! -d ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/plugins/zsh-completions ]] && git clone https://github.com/zsh-users/zsh-completions.git ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/plugins/zsh-completions || echo "do nothing" >/dev/null
    [[ ! -d ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/plugins/zsh-ssh ]] && git clone https://github.com/sunlei/zsh-ssh  ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/plugins/zsh-ssh || echo "do nothing" >/dev/null
    [[ ! -d ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/plugins/zsh-syntax-highlighting ]] && git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/plugins/zsh-syntax-highlighting || echo "do nothing" >/dev/null
  powerlevel9k-theme: |
    [[ ! -d ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/themes ]] && mkdir -p ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/themes || echo "do nothing" >/dev/null
    [[ ! -d ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/themes/powerlevel9k ]] && git clone https://github.com/bhilburn/powerlevel9k.git ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/themes/powerlevel9k || echo "do nothing" >/dev/null
  powerlevel10k-theme: |
    [[ ! -d ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/themes ]] && mkdir -p ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/themes || echo "do nothing" >/dev/null
    [[ ! -d ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/themes/powerlevel10k ]] && git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/themes/powerlevel10k || echo "do nothing" >/dev/null
dotfiles:
  d_bspwm:
    dst: ~/.config/bspwm
    src: config/bspwm
  d_colors:
    dst: ~/.vim/colors
    src: vim/colors
  d_polybar:
    dst: ~/.config/polybar
    src: config/polybar
  d_sxhkd:
    dst: ~/.config/sxhkd
    src: config/sxhkd
  f_c3check:
    dst: ~/.local/bin/c3check
    src: local/bin/c3check
  f_c3cp:
    dst: ~/.local/bin/c3cp
    src: local/bin/c3cp
  f_c3kdenlive:
    dst: ~/.local/bin/c3kdenlive
    src: local/bin/c3kdenlive
  f_c3l:
    dst: ~/.local/bin/c3l
    src: local/bin/c3l
  f_c3mpv:
    dst: ~/.local/bin/c3mpv
    src: local/bin/c3mpv
  f_compton.conf:
    dst: ~/.config/compton/compton.conf
    src: config/compton/compton.conf
  f_fehbg:
    dst: ~/.fehbg
    src: fehbg
  f_mount_c3voc:
    dst: ~/.local/bin/mount_c3voc
    src: local/bin/mount_c3voc
  f_powerlevel9krc:
    actions:
    - powerlevel9k-theme
    dst: ~/.powerlevel9krc
    src: powerlevel9krc
  f_powerlevel10krc:
    actions:
    - powerlevel10k-theme
    dst: ~/.p10k.zsh
    src: p10k.zsh
  f_profile:
    dst: ~/.profile
    src: z_profile
  f_rofi_config:
    dst: ~/.config/rofi/config
    src: config/rofi/config
  f_ssh-agent.service:
    dst: ~/.config/systemd/user/ssh-agent.service
    src: config/systemd/user/ssh-agent.service
  f_vimrc:
    dst: ~/.vimrc
    src: vimrc
  f_xinitrc:
    dst: ~/.xinitrc
    src: xinitrc
  f_xresources:
    dst: ~/.Xresources
    src: Xresources
  f_xsession:
    dst: ~/.xsession
    src: xsession
  f_zprofile:
    dst: ~/.zprofile
    src: z_profile
  f_zshenv:
    dst: ~/.zshenv
    src: zshenv
  f_zshrc:
    actions:
    - oh-my-zsh
    dst: ~/.zshrc
    src: zshrc
  f_start_systemd_shell.sh:
    src: start_systemd_shell.sh
    dst: ~/start_systemd_shell.sh
  f_kite:
    src: local/bin/kite
    dst: ~/.local/bin/kite
  f_wsladdhypervroute:
    dst: ~/.local/bin/wsladdhypervroute
    src: local/bin/wsladdhypervroute
  f_wslenablehypervforwarding:
    dst: ~/.local/bin/wslenablehypervforwarding
    src: local/bin/wslenablehypervforwarding
  f_wslshowhypervforwarding:
    dst: ~/.local/bin/wslshowhypervforwarding
    src: local/bin/wslshowhypervforwarding
  f_pu:
    dst: ~/.local/bin/pu
    src: local/bin/pu
  f_rpki:
    dst: ~/.local/bin/rpki
    src: local/bin/rpki
  f_rmquarantine:
    dst: ~/.local/bin/rmquarantine
    src: local/bin/rmquarantine
  f_commonfunc:
    dst: ~/.commonfunc
    src: commonfunc
  f_gpgagent:
    dst: ~/.gnupg/gpg-agent.conf
    src: gnupg/gpg-agent.conf
  f_secretfiles:
    dst: ~/.local/bin/secretfiles
    src: local/bin/secretfiles
  f_agenix_helper:
    dst: ~/.local/bin/agenix-helper
    src: local/bin/agenix-helper
  f_config:
    src: ssh/config
    dst: ~/.ssh/config
    chmod: '600'
  f_p10k_mise:
    dst: ~/.config/zsh/p10k.mise.zsh
    src: config/zsh/p10k.mise.zsh
  f_finicky.js:
    src: finicky.js.age
    dst: ~/.finicky.js
    trans_install: _decrypt
    trans_update: _encrypt
  f_codew:
    src: local/bin/codew
    dst: ~/.local/bin/codew
    chmod: '700'
  f_vwrc:
    src: vwrc.age
    dst: ~/.vwrc
    trans_install: _decrypt
    trans_update: _encrypt
  f_vwfunc:
    src: vwfunc.age
    dst: ~/.vwfunc
    trans_install: _decrypt
    trans_update: _encrypt
profiles:
  meta_base:
    variables:
      linux: false
      vw: false
      wsl: false
    dotfiles:
    - d_colors
    - f_agenix_helper
    - f_codew
    - f_commonfunc
    - f_config
    - f_p10k_mise
    - f_powerlevel10krc
    - f_secretfiles
    - f_vimrc
    - f_zprofile
    - f_zshenv
    - f_zshrc
  meta_linux:
    variables:
      linux: true
    dotfiles:
    - f_profile
  meta_vw:
    variables:
      vw: true
    dotfiles:
    - f_pu
    - f_rpki
    - f_vwrc
    - f_vwfunc
  meta_wsl:
    variables:
      wsl: true
    dotfiles:
    - f_wsladdhypervroute
    - f_wslenablehypervforwarding
    - f_wslshowhypervforwarding
  os_macos:
    variables:
      distro: macos
    include:
    - meta_base
    dotfiles:
    - f_rmquarantine
    - f_finicky.js
  os_ubuntu:
    variables:
      distro: ubuntu
    include:
    - meta_base
    - meta_linux
  sbx0nucmac01.home.pphg.tech:
    include:
    - os_macos
  susanoo.local:
    include:
    - os_macos
  workspace:
    include:
    - os_ubuntu
  WVDEWOBMC005505:
    include:
    - os_macos
    - meta_vw
  WVDEWOBMC009075:
    include:
    - os_macos
    - meta_vw
