Repository navigation
Install CLI tools with mise and desktop apps with Homebrew and winget, replace the no-encryption branch with a prompt, and add CI #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
76 commits
Select commit
Hold shift + click to select a range
bf32346
zsh: load fzf key bindings with fzf --zsh
patrick-5546 d96c7de
install: move system setup into a run_onchange_before script
patrick-5546 74a403d
install: replace grm with mise
patrick-5546 2dfb843
install: manage node and go with mise
patrick-5546 c361dfc
chezmoi: replace the work and no-encryption branches with prompts
patrick-5546 d2604af
chezmoi: decrypt the key with built-in age
patrick-5546 79d7d96
cleanup: remove unused bpytop and tmuxinator configs
patrick-5546 27de067
docs: update the README for mise and the init prompts
patrick-5546 c4e693f
ci: lint the rendered templates and test chezmoi apply
patrick-5546 cbc06e2
chezmoi: keep the work setup on the work branch
patrick-5546 00139d0
unix: drop Fedora support
patrick-5546 dff8e36
unix: stop installing fonts
patrick-5546 b65e399
Remove the openvpn3 and hatch configs
patrick-5546 1c32499
mise: make the config a plain file
patrick-5546 87aa326
zsh: cache compinit and skip Ubuntu's global compinit
patrick-5546 beabb00
Windows: install the tools with mise
patrick-5546 22bfdea
mise: pin the tools with a lockfile
patrick-5546 e8f317c
CI: show what zsh printed when it times out
patrick-5546 cdf6bbd
CI: make the Ubuntu runner's zsh completion directories secure
patrick-5546 d3512fe
mise: stop installing the Copilot CLI
patrick-5546 c7037ee
Remove the Alacritty config
patrick-5546 bf22132
WSL: use the Windows PATH that WSL appends by default
patrick-5546 41cb497
Windows: install chezmoi with its one-liner, like on Linux and macOS
patrick-5546 9071154
Windows: delete the old install script
patrick-5546 bc93723
PowerShell: remove the commented-out code from the profile
patrick-5546 a8c05d8
Windows: remove the komorebi and whkd configs
patrick-5546 b680dfa
PowerShell: search history with atuin, like zsh
patrick-5546 4bb0461
Add gcc to the Windows dev bundle for nvim-treesitter
patrick-5546 c121737
Make VS Code installable from the Windows dev bundle
patrick-5546 91da897
Install gcc on Linux when there's no C compiler
patrick-5546 ef0a0f7
Add the device and remote access apps to the Windows apps bundle
patrick-5546 47c0460
Rename the tools scripts to install-cli-tools
patrick-5546 44e3f21
Install python3-venv and unzip on Linux for Mason
patrick-5546 f971838
Install the tree-sitter CLI with mise
patrick-5546 dc458e6
Install gcc and Python on Windows when they're missing
patrick-5546 6a003c2
Install the desktop apps on macOS and Windows
patrick-5546 8251a1a
Replace the UniGetUI bundles with a list of the software I've used
patrick-5546 5c91818
Create Neovim's site folder before lazy.nvim starts
patrick-5546 421dabd
Check that Neovim is ready to use after the install
patrick-5546 9a3a9cc
Explain why tree-sitter comes from conda-forge
patrick-5546 bdf8158
List the desktop apps once, for macOS and Windows
patrick-5546 5d8f7a3
Install VS Code and UniGetUI with the desktop apps
patrick-5546 fc94907
Install WizTree on macOS
patrick-5546 1cc1368
Merge the README's installation sections
patrick-5546 fb64495
Shorten the README's highlights
patrick-5546 d8a8c73
Install Bitwarden from the Mac App Store on macOS
patrick-5546 fd67700
Note which mise builds to switch once Ubuntu 22.04 is dropped
patrick-5546 3f3e442
Make the scripts that don't need templating plain files
patrick-5546 ff0a240
Say the dotfiles support Ubuntu 22.04 or later, not Linux
patrick-5546 4c5a130
Explain what the Windows prerequisites are for
patrick-5546 d955571
Shorten the Windows prerequisites to match the other OSes
patrick-5546 7a15889
Remove the redundant Import-Module PSReadLine from the profile
patrick-5546 a4a153d
Lock zsh's history file with fcntl so mise's prompt hook can skip its…
patrick-5546 7b5c047
Keep only the Windows folders that zsh uses on PATH in WSL
patrick-5546 e996c3e
Get git's GitHub credentials from gh through mise's shim
patrick-5546 5d13c5d
Hold back new releases for 7 days and update mise automatically
patrick-5546 9eaeac6
Skip the decrypt scripts once the key exists
patrick-5546 c9fee53
Use chezmoi's built-in age on every OS
patrick-5546 9bf4a71
Hold back new mise releases for 7 days on Windows's first install too
patrick-5546 794e199
Say that the WSL PATH filter needs WSL to append the Windows PATH
patrick-5546 c882eac
Check that git gets GitHub credentials from cmd on Windows
patrick-5546 c7f6fdc
Install Ghostty on macOS
patrick-5546 6a09ac2
List Outlook for Windows instead of Thunderbird in software.md
patrick-5546 9cf7ca8
Install Outlook on Windows with the desktop apps
patrick-5546 7f4d062
Load the PowerShell profile's scripts from its own folder
patrick-5546 2fe66fb
Page delta's and bat's output with Git's less on Windows
patrick-5546 d4cdd5c
Load the dotfiles' PowerShell profile when Documents is in OneDrive
patrick-5546 2d78284
Revert "Load the dotfiles' PowerShell profile when Documents is in On…
patrick-5546 632093c
Keep tools' git settings out of the dotfiles
patrick-5546 0386e75
Say how to load the profile when Documents is in OneDrive
patrick-5546 cb4658d
Keep ~/.gitconfig when it's empty
patrick-5546 cf7e008
Keep Windows' folders on WSL's PATH whatever their case
patrick-5546 ba8a79d
Say which Macs and PCs the dotfiles support
patrick-5546 2fa2a3d
Say what to do when chezmoi's config template changes
patrick-5546 ab3a411
Say why chezmoi creates ~/.gitconfig
patrick-5546 cc2c705
Don't present software.md as only for Windows
patrick-5546 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,29 @@ | ||
| {{- $encryption := promptBoolOnce . "encryption" "Decrypt the encrypted files with the key passphrase" true -}} | ||
| {{- $apps := false -}} | ||
| {{- if ne .chezmoi.os "linux" -}} | ||
| {{- $apps = promptBoolOnce . "apps" "Install the desktop apps" true -}} | ||
| {{- end -}} | ||
| {{ if eq .chezmoi.os "windows" -}} | ||
| cd: | ||
| command: "pwsh" | ||
| args: ["-NoLogo", "-NoExit", "-Command", "& {Set-Location $env:HOMEPATH/.local/share/chezmoi}"] | ||
| interpreters: | ||
| ps1: | ||
| # Skip the profile, which needs the tools that the scripts install | ||
| command: "pwsh" | ||
| args: ["-NoLogo"] | ||
| args: ["-NoLogo", "-NoProfile"] | ||
| {{ end -}} | ||
|
|
||
| data: | ||
| apps: {{ $apps }} | ||
| encryption: {{ $encryption }} | ||
| diff: | ||
| pager: "delta" | ||
| edit: | ||
| command: "nvim" | ||
| encryption: "age" | ||
| # Decrypt with chezmoi's own age on every OS, even where the age command is installed | ||
| useBuiltinAge: true | ||
| age: | ||
| identity: "{{ .chezmoi.homeDir }}/.chezmoikey.txt" | ||
| recipient: "age1tqerfm7h83nl3d6ewcmhze8jmndfaaznrt84e8r0cd9rux9l5cwq72c992" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # The desktop apps that chezmoi installs on macOS and Windows, if you answer yes | ||
| # to its prompt, skipping the ones that are already installed. Each app has a | ||
| # Homebrew cask or a Mac App Store ID for macOS, and a winget ID or a Microsoft | ||
| # Store ID for Windows. Leave them out for an OS that the app isn't on. Find | ||
| # more with `brew search`, `mas search` and `winget search`. | ||
| desktopApps = [ | ||
| # Bitwarden's Safari extension only comes with its Mac App Store app | ||
| { name = "Bitwarden", mas = 1352778147, winget = "Bitwarden.Bitwarden" }, | ||
| { name = "Docker Desktop", cask = "docker-desktop", winget = "Docker.DockerDesktop" }, | ||
| { name = "Ghostty", cask = "ghostty" }, | ||
| { name = "Microsoft To Do", mas = 1274495053, msstore = "9NBLGGH5R558" }, | ||
| { name = "Nextcloud", cask = "nextcloud", winget = "Nextcloud.NextcloudDesktop" }, | ||
| # The new Outlook for Windows, not classic Outlook | ||
| { name = "Outlook", winget = "Microsoft.Outlook" }, | ||
| { name = "Speedtest by Ookla", mas = 1153157709, winget = "Ookla.Speedtest.Desktop" }, | ||
| { name = "TorGuard", cask = "torguard", winget = "VPNetwork.TorGuard" }, | ||
| { name = "UniGetUI", winget = "Devolutions.UniGetUI" }, | ||
| { name = "Visual Studio Code", cask = "visual-studio-code", winget = "Microsoft.VisualStudioCode" }, | ||
| { name = "WireGuard", mas = 1451685025, winget = "WireGuard.WireGuard" }, | ||
| # WizTree for macOS isn't in Homebrew's casks, but in Antibody Software's tap | ||
| { name = "WizTree", cask = "antibodysw/tap/wiztree", winget = "AntibodySoftware.WizTree" }, | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,172 @@ | ||
| -- Checks that Neovim is ready to use the first time it starts after the | ||
| -- dotfiles install: lazy.nvim installs the plugins, Mason installs the tools | ||
| -- and language servers, nvim-treesitter builds the parsers, and the Python | ||
| -- language servers start. The test scripts run it on a new Python file: | ||
| -- nvim --headless check.py -S check-nvim.lua | ||
| -- It reports what it checked and the problems it finds on stderr, and exits | ||
| -- with status 1 if there are any. | ||
|
|
||
| local report = {} ---@type string[] | ||
| local function say(message) | ||
| report[#report + 1] = message | ||
| end | ||
|
|
||
| local problems = {} ---@type string[] | ||
| local function problem(message) | ||
| problems[#problems + 1] = message | ||
| end | ||
|
|
||
| -- Waits until done() returns true, for at most the given number of minutes | ||
| local function wait(minutes, done) | ||
| return vim.wait(minutes * 60 * 1000, done, 1000) | ||
| end | ||
|
|
||
| -- Opening the file already started Mason's installs, so record their errors | ||
| -- before they can fail. An error here would stop the check from running, so | ||
| -- it's reported instead | ||
| local install_errors = {} ---@type table<string, string> | ||
| local watching, watch_error = pcall(function() | ||
| require("mason-registry"):on("package:install:failed", function(pkg, err) | ||
| install_errors[pkg.name] = type(err) == "string" and err or vim.inspect(err) | ||
| end) | ||
| end) | ||
| if not watching then | ||
| problem("Can't watch Mason's installs: " .. watch_error) | ||
| end | ||
|
|
||
| local function check_plugins() | ||
| local count, installed = 0, 0 | ||
| for _, plugin in pairs(require("lazy.core.config").plugins) do | ||
| if plugin._.cond ~= false then | ||
| count = count + 1 | ||
| if not plugin._.installed then | ||
| problem("lazy.nvim didn't install " .. plugin.name) | ||
| elseif require("lazy.core.plugin").has_errors(plugin) then | ||
| problem("lazy.nvim couldn't install or build " .. plugin.name) | ||
| else | ||
| installed = installed + 1 | ||
| end | ||
| end | ||
| end | ||
| say(("lazy.nvim installed %d of %d plugins"):format(installed, count)) | ||
| end | ||
|
|
||
| local function check_mason() | ||
| local registry = require("mason-registry") | ||
| -- mason-lspconfig only installs the language servers when Neovim has a UI, so | ||
| -- do what it does in a terminal | ||
| require("mason-lspconfig.features.ensure_installed")() | ||
| -- LazyVim's tools, and the language servers it has mason-lspconfig install | ||
| local names = vim.deepcopy(LazyVim.opts("mason.nvim").ensure_installed or {}) | ||
| local server_packages = require("mason-lspconfig.mappings").get_mason_map().lspconfig_to_package | ||
| for _, server in ipairs(require("mason-lspconfig.settings").current.ensure_installed) do | ||
| names[#names + 1] = server_packages[server] or server | ||
| end | ||
|
|
||
| local packages = {} ---@type table<string, Package> | ||
| for _, name in ipairs(names) do | ||
| if registry.has_package(name) then | ||
| packages[name] = registry.get_package(name) | ||
| else | ||
| problem("Mason's registry doesn't have " .. name) | ||
| end | ||
| end | ||
| wait(10, function() | ||
| return vim.iter(packages):all(function(_, pkg) | ||
| return pkg:is_installed() or not pkg:is_installing() | ||
| end) | ||
| end) | ||
|
|
||
| local installed = {} ---@type string[] | ||
| for _, pkg in pairs(packages) do | ||
| if pkg:is_installed() then | ||
| installed[#installed + 1] = pkg.name | ||
| else | ||
| local reason = install_errors[pkg.name] or (pkg:is_installing() and "timed out" or "didn't start") | ||
| problem(("Mason didn't install %s: %s"):format(pkg.name, reason)) | ||
| end | ||
| end | ||
| table.sort(installed) | ||
| say("Mason installed " .. table.concat(installed, ", ")) | ||
| end | ||
|
|
||
| local function check_parsers() | ||
| local TS = require("nvim-treesitter") | ||
| -- The parsers LazyVim installs. Their dependencies only have queries | ||
| local langs = require("nvim-treesitter.config").norm_languages( | ||
| LazyVim.opts("nvim-treesitter").ensure_installed, | ||
| { unsupported = true, dependencies = true } | ||
| ) | ||
| local function missing() | ||
| local installed = TS.get_installed("parsers") | ||
| return vim.tbl_filter(function(lang) | ||
| return not vim.list_contains(installed, lang) | ||
| end, langs) | ||
| end | ||
| wait(10, function() | ||
| return #missing() == 0 | ||
| end) | ||
|
|
||
| local missed = missing() | ||
| for _, lang in ipairs(missed) do | ||
| problem(("nvim-treesitter didn't install the %s parser"):format(lang)) | ||
| end | ||
| for _, lang in ipairs(langs) do | ||
| if not vim.list_contains(missed, lang) then | ||
| local ok, loaded, err = pcall(vim.treesitter.language.add, lang) | ||
| if not (ok and loaded) then | ||
| problem(("Neovim can't load the %s parser: %s"):format(lang, ok and err or loaded)) | ||
| end | ||
| end | ||
| end | ||
| say(("nvim-treesitter installed %d of %d parsers"):format(#langs - #missed, #langs)) | ||
| end | ||
|
|
||
| local function check_language_servers(buf) | ||
| local names = { vim.g.lazyvim_python_lsp or "pyright", vim.g.lazyvim_python_ruff or "ruff" } | ||
| local function started(name) | ||
| return vim.iter(vim.lsp.get_clients({ bufnr = buf, name = name })):any(function(client) | ||
| return client.initialized | ||
| end) | ||
| end | ||
| wait(2, function() | ||
| return vim.iter(names):all(started) | ||
| end) | ||
|
|
||
| for _, name in ipairs(names) do | ||
| if started(name) then | ||
| say(("The %s language server started"):format(name)) | ||
| else | ||
| problem(("The %s language server didn't start for %s"):format(name, vim.api.nvim_buf_get_name(buf))) | ||
| end | ||
| end | ||
| end | ||
|
|
||
| local function check() | ||
| local buf = vim.api.nvim_get_current_buf() | ||
| check_plugins() | ||
| check_mason() | ||
| check_parsers() | ||
| check_language_servers(buf) | ||
| end | ||
|
|
||
| -- Runs once startup finishes, like a session where you open a file | ||
| vim.api.nvim_create_autocmd("VimEnter", { | ||
| once = true, | ||
| callback = vim.schedule_wrap(function() | ||
| local ok, err = xpcall(check, debug.traceback) | ||
| if not ok then | ||
| problem("The check failed: " .. err) | ||
| end | ||
| if #problems == 0 then | ||
| say("Neovim is ready to use") | ||
| end | ||
| vim.list_extend(report, problems) | ||
|
|
||
| -- On stderr, since the test scripts only show lazy.nvim's install log on | ||
| -- stdout if the check fails. Neovim's messages, which are also on stderr, | ||
| -- don't end with a newline, so the report starts with one | ||
| io.stderr:write("\n", table.concat(report, "\n"), "\n") | ||
| vim.cmd(#problems == 0 and "qall!" or "cquit") | ||
| end), | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| #!/bin/bash | ||
|
patrick-5546 marked this conversation as resolved.
Resolved
|
||
| # Renders the chezmoi templates for each OS, answering yes and then no to the | ||
| # prompts, and checks them along with the files that aren't templates: shell | ||
| # scripts with shellcheck, zsh files with zsh -n, PowerShell with its parser, | ||
| # and TOML, YAML and git config syntax. Needs chezmoi, zsh, shellcheck, pwsh, | ||
| # python3 and yq. | ||
| set -euo pipefail | ||
| cd "$(dirname "$0")/.." | ||
|
|
||
| # Home folders without the age key, so that the decrypt scripts render | ||
| declare -A os_data=( | ||
| [linux]='{"os":"linux","homeDir":"/home/lint"}' | ||
| [darwin]='{"os":"darwin","homeDir":"/Users/lint"}' | ||
| [windows]='{"os":"windows","homeDir":"C:/Users/lint"}' | ||
| ) | ||
| out=$(mktemp -d) | ||
| trap 'rm -rf "$out"' EXIT | ||
|
|
||
| toml() { # toml FILE | ||
| python3 -c 'import sys, tomllib; tomllib.load(open(sys.argv[1], "rb"))' "$1" | ||
| } | ||
|
|
||
| ps1() { # ps1 FILE | ||
| # shellcheck disable=SC2016 # PowerShell expands these | ||
| SCRIPT="$1" pwsh -NoProfile -Command ' | ||
| $errors = $null | ||
| [void][System.Management.Automation.Language.Parser]::ParseFile($env:SCRIPT, [ref]$null, [ref]$errors) | ||
| $errors | ForEach-Object { Write-Error $_.ToString() } | ||
| exit $errors.Count' | ||
| } | ||
|
|
||
| check() { # check OS TEMPLATE RENDERED | ||
| case $2 in | ||
| *.sh.tmpl) [ "$1" = windows ] || shellcheck "$3" ;; | ||
| *.ps1.tmpl) [ "$1" != windows ] || ps1 "$3" ;; | ||
| *.toml.tmpl | .chezmoiexternal.toml) toml "$3" ;; | ||
| *.yaml.tmpl | *.yml.tmpl) yq . "$3" >/dev/null ;; | ||
| dot_config/git/config.tmpl) git config --file "$3" --list >/dev/null ;; | ||
| esac | ||
| } | ||
|
|
||
| # The prompts change unrelated files, so answering all of them yes and then all | ||
| # of them no renders every branch | ||
| for os in "${!os_data[@]}"; do | ||
| for answer in true false; do | ||
| echo "# $os, answers: $answer" | ||
| chezmoi=(chezmoi --source . --override-data "{\"chezmoi\":${os_data[$os]},\"apps\":$answer,\"encryption\":$answer}") | ||
| for template in $(git ls-files '*.tmpl' .chezmoiexternal.toml .chezmoiignore); do | ||
| rendered="$out/$os-$answer/${template%.tmpl}" | ||
| mkdir -p "$(dirname "$rendered")" | ||
| if [ "$template" = .chezmoi.yaml.tmpl ]; then | ||
| "${chezmoi[@]}" execute-template --init \ | ||
| --promptBool "Decrypt the encrypted files with the key passphrase=$answer" \ | ||
| --promptBool "Install the desktop apps=$answer" \ | ||
| <"$template" >"$rendered" | ||
| else | ||
| "${chezmoi[@]}" execute-template <"$template" >"$rendered" | ||
| fi | ||
| check "$os" "$template" "$rendered" | ||
| done | ||
| done | ||
| done | ||
|
|
||
| echo "# files that aren't templates" | ||
| git ls-files -z '*.sh' | xargs -0 shellcheck | ||
| for file in dot_zshenv dot_zshrc dot_config/zsh/*.zsh; do | ||
| zsh -n "$file" | ||
| done | ||
| for file in $(git ls-files '*.ps1'); do | ||
| ps1 "$file" | ||
| done | ||
| for file in $(git ls-files '*.toml' '*.lock' ':!:.chezmoiexternal.toml'); do | ||
| toml "$file" | ||
| done | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.