diff --git a/_src.all/.chezmoi.toml.tmpl b/_src.all/.chezmoi.toml.tmpl deleted file mode 100644 index 67db791..0000000 --- a/_src.all/.chezmoi.toml.tmpl +++ /dev/null @@ -1,95 +0,0 @@ -{{- $githubToken := or (env "CZ_GITHUB_ACCESS_TOKEN") (env "CHEZMOI_GITHUB_ACCESS_TOKEN") (env "GITHUB_ACCESS_TOKEN") (env "GITHUB_TOKEN") }} -{{- if not ($githubToken) }} -{{- $githubToken = promptStringOnce . "githubToken" "Public GITHUB token (mostly for rate limits - !insecure!)" }} -{{- end }} -{{- $sysname := promptStringOnce . "sysname" "System name" }} -{{- $sysgroup := promptStringOnce . "sysgroup" "System group" }} -{{- $sysarea := promptStringOnce . "sysarea" "System area" }} -{{- $gitEmail := promptStringOnce . "gitEmail" "email address (for git commits)" }} -{{- $gitName := promptStringOnce . "gitName" "Full name (for git commits)" }} -{{- $chassisType := "desktop" }} -{{- $sysType := "posix" }} -{{- $arch_alt := "x86_64" }} -{{- $arch_alt_dash := "x86-64" }} -{{- $sysVendor := "unknown" }} -{{- $clib_flavor := "" }} -{{- if eq .chezmoi.os "darwin" }} -{{- $arch_alt := "aarch64" }} -{{- $arch_alt_dash := $arch_alt }} -{{- $sysType = "macos" }} -{{- $sysVendor = "apple" }} -{{- if contains "BatteryData" (output "ioreg" "-c" "AppleSmartBattery") }} -{{- $chassisType = "laptop" }} -{{- else }} -{{- $chassisType = "desktop" }} -{{- end }} -{{- else if eq .chezmoi.os "linux" }} -{{- $clib_flavor = "-musl" }} -# $chassisType = (output "hostnamectl" "--json=short" | mustFromJson).Chassis }} -{{- $chassisType = "server" }} -{{- else if eq .chezmoi.os "windows" }} -{{- $clib_flavor = "-msvc" }} -{{- $sysType = "windows" }} -{{- $sysVendor = "pc" }} -{{- $chassisType = (output "powershell.exe" "-NoProfile" "-NonInteractive" "-Command" "if ((Get-CimInstance -Class Win32_Battery | Measure-Object).Count -gt 0) { Write-Output 'laptop' } else { Write-Output 'desktop' }") | trim }} -{{- end }} - -{{- $scriptTempDir := "~/.cache/chezmoi/tmp" }} -scriptTempDir={{- $scriptTempDir | quote }} - -[data.sz.os] -{{- if eq .chezmoi.os "linux" }} - short={{- .chezmoi.os | quote }} -{{- else }} - short={{- substr 0 3 (.chezmoi.os) | quote }} -{{- end }} - rust_rel_target={{- printf "%s-%s%s" $sysVendor .chezmoi.os $clib_flavor | quote }} -{{- if ($arch_alt) }} - arch_alt={{- $arch_alt | quote }} -{{- end }} -{{- if ($arch_alt_dash) }} - arch_alt_dash={{- $arch_alt_dash | quote }} -{{- end }} -{{- if ($chassisType) }} - chassisType={{- $chassisType | quote }} -{{- end }} -{{- if ($sysType) }} - sysType={{- $sysType | quote }} -{{- end }} - -[data] -{{- if ($githubToken) }} - githubToken={{- $githubToken | quote }} -{{- end }} -{{- if ($sysname) }} - sysname = {{ $sysname | quote }} -{{- end }} -{{- if ($sysgroup) }} - sysgroup = {{ $sysgroup | quote }} -{{- end }} -{{- if ($sysarea) }} - sysarea = {{ $sysarea | quote }} -{{ end }} - -{{- if ($gitEmail) }} - gitEmail = {{ $gitEmail | quote }} -{{- end }} -{{- if ($gitName) }} - gitName = {{ $gitName | quote }} -{{- end }} -{{- if not ($githubToken) }} - githubToken={{- $githubToken | quote }} -{{- end }} - -[scriptEnv] - GITHUB_ACCESS_TOKEN={{- $githubToken | quote }} - GITHUB_TOKEN={{- $githubToken | quote }} - -[diff] -# command = "nvim" -# args = ["-d", "{{ "{{ .Destination }}" }}", "{{ "{{ .Target }}" }}"] - - command = "delta" - args = ["--paging=never", "{{ "{{ .Destination }}" }}", "{{ "{{ .Target }}" }}"] - pager = "delta" - diff --git a/_src.posix/.chezmoi.toml.tmpl b/_src.posix/.chezmoi.toml.tmpl deleted file mode 120000 index d33d563..0000000 --- a/_src.posix/.chezmoi.toml.tmpl +++ /dev/null @@ -1 +0,0 @@ -../_src.all/.chezmoi.toml.tmpl \ No newline at end of file diff --git a/_src.posix/.chezmoi.toml.tmpl b/_src.posix/.chezmoi.toml.tmpl new file mode 100644 index 0000000..bd15507 --- /dev/null +++ b/_src.posix/.chezmoi.toml.tmpl @@ -0,0 +1,78 @@ +{{- $githubToken := or (env "CZ_GITHUB_ACCESS_TOKEN") (env "CHEZMOI_GITHUB_ACCESS_TOKEN") (env "GITHUB_ACCESS_TOKEN") (env "GITHUB_TOKEN") }} +{{- if not ($githubToken) }} +{{- $githubToken = promptStringOnce . "githubToken" "Public GITHUB token (mostly for rate limits - !insecure!)" }} +{{- end }} +{{- $sysname := promptStringOnce . "sysname" "System name" }} +{{- $sysgroup := promptStringOnce . "sysgroup" "System group" }} +{{- $sysarea := promptStringOnce . "sysarea" "System area" }} +{{- $gitEmail := promptStringOnce . "gitEmail" "email address (for git commits)" }} +{{- $gitName := promptStringOnce . "gitName" "Full name (for git commits)" }} +{{- $chassisType := "desktop" }} +{{- $sysType := "posix" }} +{{- $altArch := "aarch64" }} +{{- $sysVendor := "unknown" }} +{{- if eq .chezmoi.os "darwin" }} +{{- $sysType = "macos" }} +{{- $sysVendor = "apple" }} +{{- if contains "BatteryData" (output "ioreg" "-c" "AppleSmartBattery") }} +{{- $chassisType = "laptop" }} +{{- else }} +{{- $chassisType = "desktop" }} +{{- end }} +{{- else if eq .chezmoi.os "linux" }} +# $chassisType = (output "hostnamectl" "--json=short" | mustFromJson).Chassis }} +{{- $chassisType = "server" }} +{{- else if eq .chezmoi.os "windows" }} +{{- $sysType = "windows" }} +{{- $sysVendor = "pc" }} +{{- $chassisType = (output "powershell.exe" "-NoProfile" "-NonInteractive" "-Command" "if ((Get-CimInstance -Class Win32_Battery | Measure-Object).Count -gt 0) { Write-Output 'laptop' } else { Write-Output 'desktop' }") | trim }} +{{- end }} + +{{- $scriptTempDir := "~/.cache/chezmoi/tmp" }} +scriptTempDir={{- $scriptTempDir | quote }} + +[data] +{{- if ($altArch) }} + altArch={{- $altArch | quote }} +{{- end }} +{{- if ($chassisType) }} + chassisType={{- $chassisType | quote }} +{{- end }} +{{- if ($sysType) }} + sysType={{- $sysType | quote }} +{{- end }} +{{- if ($githubToken) }} + githubToken={{- $githubToken | quote }} +{{- end }} +{{- if ($sysname) }} + sysname = {{ $sysname | quote }} +{{- end }} +{{- if ($sysgroup) }} + sysgroup = {{ $sysgroup | quote }} +{{- end }} +{{- if ($sysarea) }} + sysarea = {{ $sysarea | quote }} +{{ end }} + +{{ if ($gitEmail) }} + gitEmail = {{ $gitEmail | quote }} +{{- end }} +{{- if ($gitName) }} + gitName = {{ $gitName | quote }} +{{- end }} +{{- if not ($githubToken) }} + githubToken={{- $githubToken | quote }} +{{- end }} + +[scriptEnv] + GITHUB_ACCESS_TOKEN={{- $githubToken | quote }} + GITHUB_TOKEN={{- $githubToken | quote }} + +[diff] +# command = "nvim" +# args = ["-d", "{{ "{{ .Destination }}" }}", "{{ "{{ .Target }}" }}"] + + command = "delta" + args = ["--paging=never", "{{ "{{ .Destination }}" }}", "{{ "{{ .Target }}" }}"] + pager = "delta" + diff --git a/_src.posix/.chezmoiexternal.yaml b/_src.posix/.chezmoiexternal.yaml index 62caaa2..ec0bbda 100644 --- a/_src.posix/.chezmoiexternal.yaml +++ b/_src.posix/.chezmoiexternal.yaml @@ -1,37 +1,25 @@ # https://www.chezmoi.io/reference/special-files-and-directories/chezmoiexternal-format/ -# The file will be empty (except for this comment) unless CZ_EXTR env variable exists. # # The externals are checked based on the refreshPeriod whenever an `apply` (or `update`) operations run # -# The syntax to update all externals (and nothing else): +# The simplest form to update all externals: # ```sh -# CZ_EXTR=1 chezmoi apply --include externals +# chezmoi apply --include externals # ``` # -{{/* -# # Variable Type Default Description # type string none External type (file, archive, archive-file, or git-repo) # url string none URL # refreshPeriod duration 0 Refresh period (Examples: one day (24h), one week (168h), or four weeks (672h)) # executable bool false Add executable_ attribute to file # path string none Path to file in archive -*/}} -{{- if (env "CZ_EXTR") -}} -{{/* Initialize template variables */}} -{{- $myArch := "" -}} -{{- $defaultRefresh := "168h" -}} + +{{- if not (env "OFFLINE") -}} + +{{ $defaultRefresh := "168h" -}} {{- $externals := dict -}} -{{/* -# valid arch strings: -# aarch64-apple-darwin -# x86_64-apple-darwin -# aarch64-unknown-linux-musl -# x86_64-unknown-linux-musl -*/}} - -{{ $myArch = (printf "%s-%s" .sz.os.arch_alt .sz.os.rust_rel_target )}} +{{ $myArch := "x86_64-unknown-linux-musl" }} {{- with $repo := "zellij-org/zellij" -}} {{- with $version := (gitHubLatestRelease $repo).GetTagName -}} @@ -43,7 +31,7 @@ "refreshPeriod" $defaultRefresh ) -}} {{- end -}} -{{- end -}} +{{- end }} {{- with $repo := "dandavison/delta" -}} {{- with $version := (gitHubLatestRelease $repo).GetTagName -}} @@ -56,18 +44,7 @@ {{- end -}} {{- end -}} -{{/* -# valid arch strings: -# darwin_amd64 -# darwin_arm64 -# linux_386 -# linux_amd64 -# linux_arm64 -# windows_386 -# windows_amd64 -# windows_arm64 -*/}} -{{- $myArch = (printf "%s_%s" .chezmoi.os .chezmoi.arch) -}} +{{ $myArch = "linux_amd64" }} {{- with $repo := "hickford/git-credential-oauth" -}} {{- with $version := trimPrefix "v" (gitHubLatestRelease $repo).GetTagName -}} @@ -81,21 +58,7 @@ {{- end -}} {{- end -}} -{{/* -# valid arch strings: -# linux-aarch64 -# linux-arm -# linux-armv7 -# linux-x86_64 -# mac-x86 -# mac -# win -*/}} - -{{- $myArch = .sz.os.short -}} -{{- if eq .chezmoi.os "linux" -}} -{{- $myArch = (printf "%s-%s" .chezmoi.os .sz.os.arch_alt) -}} -{{- end -}} +{{ $myArch = "linux-x86_64" }} {{- with $repo := "extrawurst/gitui" -}} {{- with $version := (gitHubLatestRelease $repo).GetTagName -}} @@ -107,47 +70,9 @@ "refreshPeriod" $defaultRefresh ) -}} {{- end -}} -{{- end -}} +{{- end }} - -{{/* -# valid arch strings: -# darwin-amd64 -# darwin-arm64 -# freebsd-amd64 -# freebsd-arm64 -# linux-amd64 -# linux-arm64 -# openbsd-amd64 -# openbsd-arm64 -# windows-amd64 -# windows-arm64 -*/}} -{{- $myArch = (print .chezmoi.os "-" .chezmoi.arch) -}} - -{{- with $repo := "Lifailon/lazyjournal" -}} -{{- with $version := (gitHubLatestRelease $repo).GetTagName -}} -{{- $_ := set $externals ".local/bin/lazyjournal" (dict - "type" "file" - "url" (printf "https://github.com/%s/releases/download/%s/lazyjournal-%s-%s" $repo $version $version $myArch) - "executable" true - "refreshPeriod" $defaultRefresh -) -}} -{{- end -}} -{{- end -}} - -{{/* -# valid arch strings: -# Darwin_arm64 -# Darwin_x86_64 -# Linux_arm64 -# Linux_i386 -# Linux_x86_64 -# Windows_arm64 -# Windows_i386 -# Windows_x86_64 -*/}} -{{- $myArch = (printf "%s_%s" ( .chezmoi.os | title ) .sz.os.arch_alt) -}} +{{ $myArch = "linux_x86_64" }} {{- with $repo := "theimpostor/osc" -}} {{- with $version := (gitHubLatestRelease $repo).GetTagName -}} @@ -159,7 +84,20 @@ "refreshPeriod" $defaultRefresh ) -}} {{- end -}} -{{- end -}} +{{- end }} + +{{ $myArch = "linux-amd64" }} + +{{- with $repo := "Lifailon/lazyjournal" -}} +{{- with $version := (gitHubLatestRelease $repo).GetTagName -}} +{{- $_ := set $externals ".local/bin/lazyjournal" (dict + "type" "file" + "url" (printf "https://github.com/%s/releases/download/%s/lazyjournal-%s-%s" $repo $version $version $myArch) + "executable" true + "refreshPeriod" $defaultRefresh +) -}} +{{- end -}} +{{- end }} {{- $externals | toYaml }} ".config/sz.env/lib/ble.sh.curl": @@ -184,5 +122,5 @@ refreshPeriod: "{{ $defaultRefresh }}" {{- else -}} -# .chezmoiexternal is disabled because CZ_EXTR env is undefined -{{- end -}} +# .chezmoiexternal is disabled because OFFLINE env is defined +{{- end -}} \ No newline at end of file