From 77b49ef2192d254467404d65d3dbec5895163ec8 Mon Sep 17 00:00:00 2001 From: "Lockszmith (wsl@Sygin)" Date: Wed, 9 Apr 2025 21:31:09 -0400 Subject: [PATCH] .chezmoiexternal syntax improvments - always include 'staticly defined' (aka. fast) yaml entries - default tgz/zip assignment on cargo-binstall --- _src.posix/.chezmoiexternal.yaml.tmpl | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/_src.posix/.chezmoiexternal.yaml.tmpl b/_src.posix/.chezmoiexternal.yaml.tmpl index ab86e09..d5403ba 100644 --- a/_src.posix/.chezmoiexternal.yaml.tmpl +++ b/_src.posix/.chezmoiexternal.yaml.tmpl @@ -17,10 +17,11 @@ # executable bool false Add executable_ attribute to file # path string none Path to file in archive */}} +{{- $defaultRefresh := "168h" -}} + {{- if (env "CZ_EXTR") -}} {{/* Initialize template variables */}} {{- $myArch := "" -}} -{{- $defaultRefresh := "168h" -}} {{- $externals := dict -}} {{/* @@ -76,10 +77,7 @@ "refreshPeriod" $defaultRefresh ) -}}{{- end -}}{{- end -}}{{- end -}} -{{- $archive_type := "zip" -}} -{{- if (eq .chezmoi.os "linux" ) -}} -{{- $archive_type = "tgz" -}} -{{- end -}} +{{- $archive_type := or (get (dict "linux" "tgz") .chezmoi.os) "zip" }} {{- with $app_name := "cargo-binstall" -}} {{- with $repo := (printf "%s/%s" "cargo-bins" $app_name) -}} {{- with $version := (gitHubLatestRelease $repo).GetTagName -}} @@ -268,7 +266,12 @@ "refreshPeriod" $defaultRefresh ) -}}{{- end -}}{{- end -}}{{- end }}{{- end -}} -{{- $externals | toYaml }} +{{- $externals | toYaml -}} +{{- else -}} +# This is a truncated version of .chezmoiexternal because CZ_EXTR env is undefined + +{{- end }} + ".config/sz.env/lib/ble.sh.curl": type: "archive" url: "https://github.com/akinomyoga/ble.sh/releases/download/nightly/ble-nightly.tar.xz" @@ -296,7 +299,3 @@ executable: true refreshPeriod: "{{ $defaultRefresh }}" {{- end -}} - -{{- else -}} -# .chezmoiexternal is disabled because CZ_EXTR env is undefined -{{- end -}}