install.fairie/.local/share/chezmoi/home/.chezmoi.yaml.tmpl

239 lines
11 KiB
Cheetah
Raw Normal View History

{{- $name := (default "Brian Zalewski" (env "FULL_NAME")) -}}
{{- $email := (default "brian@megabyte.space" (env "PRIMARY_EMAIL")) -}}
{{- $restricted := (default false (env "WORK_ENVIRONMENT")) -}}
{{- $work := (default false (env "WORK_ENVIRONMENT")) -}}
{{- $gpgKeyId := (default "0xF0A300E4199A1C33" (env "KEYID")) -}}
{{- $gmailAddress := (default "blzalewski@gmail.com" (env "GMAIL_ADDRESS")) -}}
{{- $gmailAddressAppPassword := (default "" (env "GMAIL_APP_PASSWORD")) -}}
{{- $domain := (default "megabyte.space" (env "PUBLIC_SERVICES_DOMAIN")) -}}
{{- $cloudflareUsername := (default "brian@megabyte.space" (env "CLOUDFLARE_USERNAME")) -}}
{{- $cloudflareToken := (default "" (env "CLOUDFLARE_API_TOKEN")) -}}
{{- $cloudflareAccessKeyId := "" -}}
{{- $cloudflareSecretAccessKey := "" -}}
{{- $cloudflareR2AccountId := "" -}}
{{- $githubUsername := (default "ProfessorManhattan" (env "GITHUB_USERNAME")) -}}
{{- $githubReadToken := (env "GITHUB_READ_TOKEN") -}}
{{- $gitlabReadToken := (env "GITLAB_READ_TOKEN") -}}
{{- $locale := (output "echo" "$LANG") }}
{{- $ngrokAuthToken := (default "" (env "NGROK_AUTH_TOKEN")) -}}
{{- $slackApiToken := (default "" (env "SLACK_API_TOKEN")) -}}
{{- $tabbyConfigId := (default "" (env "TABBY_CONFIG_ID")) -}}
{{- $tabbySyncToken := (default "" (env "TABBY_SYNC_TOKEN")) -}}
{{- $timezone := (default "America/New_York" (env "TIMEZONE")) -}}
{{- $toolchains := list "CLI-Extras" "Docker" "Go" "Kubernetes" "Web-Development" -}}
{{- $desktopSession := true -}}
{{- if and (ne .chezmoi.os "darwin") (ne .chezmoi.os "windows") (not (env "DISPLAY")) -}}
{{- $desktopSession = false -}}
{{- end -}}
{{- $softwareGroup := (default "Standard" (env "SOFTWARE_GROUP")) -}}
{{- if $desktopSession -}}
{{- $softwareGroup = list $softwareGroup "-Desktop" | join "" -}}
{{- end -}}
{{- $data := . }}
{{- $_ := set $data "host" (default (dict) (get $data "host")) -}}
{{- $_ := set $data "user" (default (dict) (get $data "user")) -}}
{{- $_ := set $data "toolchains" (default (dict) (get $data "toolchains")) -}}
{{- $headless := false -}}
{{- $ephemeral := false -}}
{{/* detect GitHub codespaces, VSCode remote containers, Docker containers, Multipass VMs, and Vagrant boxes */}}
{{- $ephemeralEnvOrUsername := or (env "CODESPACES") (env "REMOTE_CONTAINERS_IPC") (eq .chezmoi.username "root" "ubuntu" "vagrant" "vscode" "devcontainer") -}}
{{- $ephemeralCgroup := and (stat "/proc/1/cgroup") (output "cat" "/proc/1/cgroup" | regexMatch "(docker|lxc)") -}}
{{- if or $ephemeralEnvOrUsername $ephemeralCgroup -}}
{{- $headless = true -}}
{{- $ephemeral = true -}}
{{- writeToStdout "Chezmoi is running in a container.\n" -}}
{{- end -}}
{{- $chassisType := "desktop" }}
{{- if $ephemeral -}}
{{- $chassisType = "ephemeral" }}
{{- else if eq .chezmoi.os "linux" }}
{{- if (.chezmoi.kernel.osrelease | lower | contains "microsoft") -}}
{{- $chassisType = "wsl" }}
{{- else -}}
{{- $chassisType = (output "hostnamectl" "--json=short" | mustFromJson).Chassis }}
{{- end -}}
{{- else if eq .chezmoi.os "darwin" }}
{{- if contains "MacBook" (output "sysctl" "-n" "hw.model") }}
{{- $chassisType = "laptop" }}
{{- else }}
{{- $chassisType = "desktop" }}
{{- end }}
{{- else if eq .chezmoi.os "windows" }}
{{- $chassisType = (output "powershell.exe" "-noprofile" "-command" "if (Get-WmiObject -Class win32_battery -ComputerName localhost) { echo laptop } else { echo desktop }") }}
{{- end }}
{{- $cpuCores := 1 }}
{{- $cpuThreads := 1 }}
{{- if eq .chezmoi.os "darwin" }}
{{- $cpuCores = (output "sysctl" "-n" "hw.physicalcpu_max") | trim | atoi }}
{{- $cpuThreads = (output "sysctl" "-n" "hw.logicalcpu_max") | trim | atoi }}
{{- else if eq .chezmoi.os "linux" }}
{{- $cpuCores = (output "sh" "-c" "lscpu --online --parse | grep --invert-match '^#' | sort --field-separator=',' --key='2,4' --unique | wc --lines") | trim | atoi }}
{{- $cpuThreads = (output "sh" "-c" "lscpu --online --parse | grep --invert-match '^#' | wc --lines") | trim | atoi }}
{{- else if eq .chezmoi.os "windows" }}
{{- $cpuCores = (output "powershell.exe" "-NoProfile" "-NonInteractive" "-Command" "(Get-CimInstance -ClassName 'Win32_Processor').NumberOfCores") | trim | atoi }}
{{- $cpuThreads = (output "powershell.exe" "-NoProfile" "-NonInteractive" "-Command" "(Get-CimInstance -ClassName 'Win32_Processor').NumberOfLogicalProcessors") | trim | atoi }}
{{- end }}
{{- $toolchainsEnabled := dict }}
{{- range $toolchain := $toolchains }}
{{- $withoutToolchains := env "WITHOUT_TOOLCHAINS" -}}
{{- $withoutToolchain := env (list "WITHOUT" (upper $toolchain) | join "_") -}}
{{- $withToolchain := env (list "WITH" (upper $toolchain) | join "_") -}}
{{- if and (or $withoutToolchains $withoutToolchain) (not $withToolchain) -}}
{{- writeToStdout (list "Disabled" $toolchain "toolchain.\n" | join " ") -}}
{{- $_ := set $toolchainsEnabled $toolchain false }}
{{- else }}
{{- $_ := set $toolchainsEnabled $toolchain true }}
{{- end}}
{{- end }}
{{- if stdinIsATTY -}}
{{- range $toolchain := $toolchains }}
{{- $enabled := promptBoolOnce $data.toolchains $toolchain (list "Enable" $toolchain "toolchain" | join " ") (get $toolchainsEnabled $toolchain) -}}
{{- if and (eq $toolchain "Kubernetes") $enabled (not $toolchainsEnabled.Docker) -}}
{{- $_ := set $toolchainsEnabled "Docker" $enabled }}
{{- writeToStdout "Enabled Docker toolchain to support Kubernetes.\n" -}}
{{- end -}}
{{- $_ := set $toolchainsEnabled $toolchain $enabled }}
{{- end }}
{{- if not (env "WORK_ENVIRONMENT") -}}
{{- $work = promptBoolOnce $data.host "work" "Work environment" $work -}}
{{- end -}}
{{- if not (env "RESTRICTED_ENVIRONMENT") -}}
{{- $restricted = promptBoolOnce $data.host "restricted" "Restricted environment (i.e. no sudo)" $restricted -}}
{{- end -}}
{{- if not (env "SOFTWARE_GROUP") -}}
{{- $softwareGroup = promptStringOnce $data.host "softwareGroup" "Software group" $softwareGroup -}}
{{- end -}}
{{- if not (env "FULL_NAME") -}}
{{- $name = promptStringOnce $data.user "name" "Full name" $name -}}
{{- end -}}
{{- if not (env "PRIMARY_EMAIL") -}}
{{- $email = promptStringOnce $data.user "email" "Primary e-mail address" $email -}}
{{- end -}}
{{- if not (env "KEYID") -}}
{{- $gpgKeyId = promptStringOnce $data.user "gpgKeyId" "Public GPG key ID" $gpgKeyId -}}
{{- end -}}
{{- if not (env "PUBLIC_SERVICES_DOMAIN") -}}
{{- $domain = promptStringOnce $data.user "domain" "Domain name" $domain -}}
{{- end -}}
{{- if not (env "TIMEZONE") -}}
{{- $timezone = promptStringOnce $data.user "timezone" "Timezone" $timezone -}}
{{- end -}}
{{- if not (env "CLOUDFLARE_TOKEN") -}}
{{- $cloudflareToken = promptStringOnce $data.user "cloudflareToken" "CloudFlare API Token" $cloudflareToken -}}
{{- end -}}
{{- if not (env "GITHUB_USERNAME") -}}
{{- $githubUsername = promptStringOnce $data.user "githubUsername" "GitHub username" $githubUsername -}}
{{- end -}}
{{- if not (env "GITLAB_READ_TOKEN") -}}
{{- $gitlabReadToken = promptStringOnce $data.user "gitlabReadToken" "GitLab read-only token" $gitlabReadToken }}
{{- end -}}
{{- if not (env "GITHUB_READ_TOKEN") -}}
{{- $githubReadToken = promptStringOnce $data.user "githubReadToken" "GitHub read-only token" $githubReadToken }}
{{- end -}}
{{- if not (env "GMAIL_ADDRESS") -}}
{{- $gmailAddress = promptStringOnce $data.user "gmailAddress" "G-mail address" $gmailAddress -}}
{{- end -}}
{{- if not (env "GMAIL_APP_PASSWORD") -}}
{{- $gmailAddressAppPassword = promptStringOnce $data.user "gmailAddressAppPassword" "G-mail app password" $gmailAddressAppPassword -}}
{{- end -}}
{{- if not (env "NGROK_AUTH_TOKEN") -}}
{{- $ngrokAuthToken = promptStringOnce $data.user "ngrokAuthToken" "Ngrok authentication token" $ngrokAuthToken -}}
{{- end -}}
{{- if not (env "SLACK_API_TOKEN") -}}
{{- $slackApiToken = promptStringOnce $data.user "slackApiToken" "Slack API token" $slackApiToken -}}
{{- end -}}
{{- if not (env "TABBY_CONFIG_ID") -}}
{{- $tabbyConfigId = promptStringOnce $data.user "tabbyConfigId" "Tabby configuration ID" $tabbyConfigId -}}
{{- end -}}
{{- if not (env "TABBY_SYNC_TOKEN") -}}
{{- $tabbySyncToken = promptStringOnce $data.user "tabbySyncToken" "Tabby Sync token" $tabbySyncToken -}}
{{- end -}}
{{- else -}}
{{- $headless = true -}}
{{- writeToStdout "Chezmoi is running in headless environment.\n" -}}
{{- end -}}
encryption: "age"
age:
identity: "{{ .chezmoi.homeDir }}/.config/age/chezmoi.txt"
recipient: "age1necy24c4lzxheey4p2m8v4q000n442wyv47qc640ulyxx9l8dpesdqv7ey"
gpg:
recipient: "{{ $gpgKeyId }}"
data:
host:
arch: "{{ .chezmoi.arch }}"
cpu:
cores: "{{ $cpuCores }}"
threads: "{{ $cpuThreads }}"
desktopSession: "{{ $desktopSession }}"
distro:
family: "{{ .chezmoi.os }}"
id: "{{ get .chezmoi.osRelease "id" | default .chezmoi.os }}"
home: "{{ .chezmoi.homeDir }}"
homeParentFolder: "{{ if eq .chezmoi.os "linux" }}/home{{ else if eq .chezmoi.os "darwin" }}/Users{{ else }}C:\Users{{ end }}"
Update dotfiles/.local/share/chezmoi/home/private_dot_config/environments/terminal, dotfiles/.local/software/development/Brewfile, dotfiles/.local/share/chezmoi/home/private_dot_config/environments/development, dotfiles/.local/share/chezmoi/home/private_dot_config/environments/desktop, dotfiles/.local/software/desktop/Brewfile, dotfiles/.local/software/desktop/Packages.config, dotfiles/.local/software/desktop/Wingetfile, dotfiles/.local/software/development/Packages.config, dotfiles/.local/software/development/Scoopfile, dotfiles/.local/software/terminal/Brewfile, dotfiles/.local/software/terminal/Packages.config, dotfiles/.local/software/terminal/Scoopfile, dotfiles/.local/software/Gasfile.yml, dotfiles/.local/share/chezmoi/home/.chezmoiexternal.toml, dotfiles/.local/share/chezmoi/home/.chezmoidata.yaml, dotfiles/.local/share/chezmoi/system/etc/timeshift/timeshift.json, dotfiles/.local/share/chezmoi/home/private_dot_config/VirtualBox/VirtualBox.xml.tmpl, dotfiles/.local/share/chezmoi/home/Library/VirtualBox/VirtualBox.xml, dotfiles/.local/share/chezmoi/home/dot_VirtualBox/VirtualBox.xml, dotfiles/.local/share/chezmoi/home/private_dot_config/shell/exports.tmpl, dotfiles/.local/share/chezmoi/system/.chezmoiexternal.toml, dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_install-software, dotfiles/.local/share/chezmoi/home/private_dot_config/shell/aliases.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/roles/run_onchange_after_symlink-ansible-roles, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/symlink_environments.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/symlink_playbooks.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/tasks/symlink_qubes.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/symlink_README.md.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/symlink_Vagrantfile.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/symlink_ansible.cfg.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/symlink_main.yml.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/symlink_requirements.yml.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/run_onchange_after_symlink-ansible-configs, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/symlink_docs.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/plugins/action/symlink_commonlib.py.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/plugins/action/symlink_qubes_pass.py.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/plugins/action/symlink_qubesformation.py.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/plugins/action/symlink_qubesguid.py.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/plugins/action/symlink_qubessls.py.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/plugins/connection/symlink_qubes.py.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/plugins/lookup/symlink_jq.py.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/plugins/lookup/symlink_qubes-pass.py.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/plugins/library/symlink_qubes_pass.py.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/plugins/library/symlink_qubesformation.py.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/plugins/library/symlink_qubesguid.py.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/plugins/library/symlink_qubessls.py.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/bin/symlink_bombshell-client.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/bin/symlink_qrun.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/bin/symlink_qssh.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/bin/symlink_qscp, dotfiles/.local/share/chezmoi/home/.chezmoi.yaml.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/bin/run_onchange_ensure-executable.tmpl Deleted dotfiles/.local/share/chezmoi/home/private_dot_config/environments/work
2022-11-27 06:59:13 -08:00
qubes: {{ ne (stat (joinPath "usr" "bin" "qubes-session")) false }}
softwareGroup: "{{ $softwareGroup }}"
type: "{{ $chassisType }}"
work: {{ $work }}
restricted: {{ $restricted }}
headless: {{ $headless }}
toolchains:
{{- range $toolchain, $enabled := $toolchainsEnabled }}
{{ $toolchain}}: {{ $enabled }}
{{- end }}
user:
email: "{{ $email }}"
name: "{{ $name }}"
username: "{{ output "echo" "$USER" }}"
domain: "{{ $domain }}"
gpg:
id: "{{ $gpgKeyId }}"
gmail:
email: "{{ $gmailAddress }}"
password: "{{ $gmailAddressAppPassword }}"
githubUsername: "{{ $githubUsername }}"
locale: "{{ $locale }}"
timezone: "{{ $timezone }}"
CLOUDFLARE_USERNAME: "{{ $cloudflareUsername }}"
CLOUDFLARE_ACCESS_KEY_ID: "{{ $cloudflareAccessKeyId }}"
CLOUDFLARE_SECRET_ACCESS_KEY: "{{ $cloudflareSecretAccessKey }}"
CLOUDFLARE_R2_ACCOUNT_ID: "{{ $cloudflareR2AccountId }}"
CLOUDSDK_CORE_PROJECT: "megabyte-labs"
GCE_CREDENTIALS_FILE: "{{ joinPath .chezmoi.homeDir ".config" "gcp.json" }}"
GCE_SERVICE_ACCOUNT_EMAIL: "molecule@megabyte-labs.iam.gserviceaccount.com"
GITHUB_READ_TOKEN: "{{ $githubReadToken }}"
GITLAB_READ_TOKEN: "{{ $gitlabReadToken }}"
NGROK_AUTH_TOKEN: "{{ $ngrokAuthToken }}"
SLACK_API_TOKEN: "{{ $slackApiToken }}"
SNAPCRAFT_EMAIL: "{{ $email }}"
TABBY_CONFIG_ID: "{{ $tabbyConfigId }}"
TABBY_SYNC_TOKEN: "{{ $tabbySyncToken }}"
TINYPNG_API_KEY: "g355tx7dxG5yJfl0RXJnpQlQqk88dJBv"
diff:
format: "git"
pager: "delta"
git:
autoCommit: true
autoPush: true
scriptEnv:
LEXICON_CLOUDFLARE_USERNAME: "{{ $cloudflareUsername }}"
LEXICON_CLOUDFLARE_TOKEN: "{{ $cloudflareToken }}"
textconv:
- pattern: "**/*.plist"
command: "plutil"
args:
- "-convert"
- "xml1"
- "-o"
- "-"
- "-"