kergoth / dotfiles-chezmoi

Prototype dotfiles rework using chezmoi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kergoth's Dotfiles and Setup Scripts

BlueOak 1.0.0 License

This repository includes scripts for setting up systems per my personal preferences.

Prerequisites

  • (On macOS) Command-Line Tools or XCode must be installed (See scripts/extras/ for scripts to install these).

Usage

Initial dotfiles setup

This setup will apply the dotfiles, and will also install packages with home-manager, if nix is installed.

If the repository has not yet been cloned:

chezmoi init --apply kergoth/dotfiles-chezmoi

If the repository is already cloned and you've changed directory to it:

./script/setup

User Setup

This setup will apply the dotfiles, but will also apply other changes to the current user configuration.

After cloning the repository, and changing directory to it, run:

./script/setup-user

On windows (in powershell, not WSL), run this instead:

./script/setup-user.ps1

System Setup

On Arch and FreeBSD, early setup scripts exist in ./script/arch and ./script/freebsd, respectively. These are self-contained and may be used without cloning the repository:

  • os-install: Currently I only have a single script for this, which is Arch. This is run as root, prior to rebooting into the newly installed system, and is intended to install and perform initial early system setup such as bootloader installation. This script is intended to be able to run without cloning this repository, so must be self-contained, and by definition is os/distro-specific, so exists in a subdirectory of script/ for each.
  • setup-root: This is run as root, after OS installation, before our user has sudo/doas access, possibly before our user exists, and its purpose is to do just this, add our user and ensure it can use sudo or doas, and nothing more. This script is intended to be able to run without cloning this repository, so must be self-contained, and by definition is os/distro-specific, so exists in a subdirectory of script/ for each.

The setup-system script is run by a non-root user with sudo/doas access, to perform post-install system-level setup and configuration. This script will apply changes to the system as a whole. This may include installing packages through the package manager, installing nix, et cetera. Ideally this should be run prior to setting up the user, and should be run as a user with sudo access.

After cloning the repository, and changing directory to it, run:

./script/setup-system

On windows (in powershell, not WSL), run this instead:

./script/setup-system.ps1

Edit dotfiles

chezmoi edit --watch ~/.config/zsh/.zshrc

Apply dotfiles changes to the home directory

This step is implicitly done by the boostrap script. To run it manually, for example, after editing files inside the repository checkout, run this:

chezmoi apply

Update the dotfiles, including external files

chezmoi update -R

Update the dotfiles, external files, and home directory packages

./script/update

Manual Setup Steps

Manual Setup Steps for macOS

  • Enable secure keyboard entry in Terminal

  • ./scripts/extras/enable-filevault

  • System Settings > Lock Screen

    • Set “Require password after screen saver begins or display is turned off” to after 5 seconds or less.
  • System Settings > Privacy & Security > Security

    • Set “Allow applications downloaded from App Store and identified developers” at most.
  • Run vscode, enable settings sync

  • Run vivaldi, enable sync

  • Run deliveries, click yes to import from iCloud

  • Run musicharbor, click yes to import from iCloud

  • Run appcleaner, preferences, enable smartdelete

  • Run alfred, preferences, advanced, enable sync to ~/Sync/App Settings/Alfred

  • Safari

    • Change the default scale to 85%
    • Add site settings icon
    • Add cloud tabs icon
    • Rearrange icons
  • Syncthing Shares

    • Sync/dotfiles-local
    • Sync/App Settings
    • Library/Fonts

Manual Setup Steps for Windows

  • Set up all my Syncthing shares

  • Restore from backup:

    • $USERPROFILE/Apps
    • Vivaldi: AppData/Local/Vivaldi/User Data/Default/
    • HexChat: AppData/Roaming/HexChat
    • archwsl disk image
  • Run QuickLook, right click its icon, click start at login

  • Create link to CapsLockCtrlEscape.exe in Startup (win-r -> shell:startup)

  • Install Fonts from Sync/Fonts

  • Run vscode, enable settings sync

  • Run ssh-add in powershell to add my key to the agent, if it exists

  • Remove Edge, Store, Mail from the task bar pins.

What's Included

External Scripts included in the dotfiles for non-Windows platforms

  • cht.sh: Command-line client for cheat.sh, the only cheat sheet you need.

Installed CLI Packages

  • wget: A free software package for retrieving files using HTTP, HTTPS, FTP and FTPS.

  • git: A free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

  • git-lfs: An open source Git extension for versioning large files.

  • neovim: Hyperextensible Vim-based text editor.

  • rust: A multi-paradigm, general-purpose programming language.

  • go: An open source programming language supported by Google

  • python: A programming language that lets you work quickly and integrate systems more effectively.

  • pipx: Install and run python applications in isolated environments.

  • bat: A cat(1) clone with syntax highlighting and Git integration.

  • choose: A human-friendly and fast alternative to cut and (sometimes) awk.

  • delta: A syntax-highlighting pager for git, diff, and grep output.

  • direnv: An extension for your shell which can load and unload environment variables depending on the current directory.

  • duf: Disk Usage/Free Utility - a better 'df' alternative.

  • dua: View disk space usage and delete unwanted data, fast. This is a faster version of ncdu.

  • dust: A more intuitive version of du in rust.

  • eza or exa: A modern replacement for ls.

  • fd: A simple, fast and user-friendly alternative to 'find'.

  • fzf: A command-line fuzzy finder.

  • git-absorb: git commit --fixup, but automatic.

  • git-branchless: High-velocity, monorepo-scale workflow for Git.

  • git-imerge: Incremental merge for git.

  • git-revise: A handy tool for doing efficient in-memory commit rebases & fixups.

  • jira-cli: Feature-rich interactive Jira command line.

  • jq: A lightweight and flexible command-line JSON processor.

  • peru: A generic package manager, for including other people's code in your projects.

  • ripgrep: A line-oriented search tool that recursively searches the current directory for a regex pattern.

  • sad: CLI search and replace | Space Age seD.

  • sapling: A Scalable, User-Friendly Source Control System.

  • sd: Intuitive find & replace CLI (sed alternative).

  • shellcheck: A static analysis tool for shell scripts.

  • shfmt: Format shell programs.

  • unar: Universal archives extractor. Available via brew, nix, and scoop.

  • zoxide: A smarter cd command, inspired by z and autojump.

  • zstd: Zstandard - Fast real-time compression algorithm.

CLI Packages on Linux and macOS

  • nix: Nix is a tool that takes a unique approach to package management and system configuration.

  • patchutils: A small collection of programs that operate on patch files.

    • On Windows, patchutils can be used via either WSL or MSYS2 (which can be installed via scoop and run as msys2, ex. msys2 -c 'exec filterdiff "$@"' -).
  • ssh-copy-id: Install your identity.pub in a remote machine’s authorized_keys.

    • On Windows, I have a powershell function which does this, and is aliased to ssh-copy-id.
  • tmux: An open-source terminal multiplexer.

    • There are no good options for tmux or tmux-equivalent on Windows. The closest you can get is just splits in Windows Terminal, which doesn't give you the ability to disconnect.

CLI Packages on macOS

  • lima: Linux virtual machines, typically on macOS, for running containerd.
  • colima: Container runtimes on macOS (and Linux) with minimal setup.
  • duti: A command-line tool to select default applications for document types and URL schemes on Mac OS X.
  • mas: Mac App Store command line interface.
  • reattach-to-user-namespace: Reattach to the per-user bootstrap namespace. This is needed for tools like tmux, though tmux 2.6+ apparently incorporates this functionality already.
  • trash: A small command-line program for OS X that moves files or folders to the trash.

CLI Packages on Linux and FreeBSD

The intention is to incorporate the installation of Nix on all systems in time.

  • zsh: A shell designed for interactive use, although it is also a powerful scripting language. This is installed by default on macOS.
CLI Packages on Arch Linux
  • openssh: The premier connectivity tool for remote login with the SSH protocol.
  • avahi: A system which facilitates service discovery on a local network via mDNS.
  • nss-mdns: A GNU Libc NSS module that provides mDNS host name resolution.

CLI Packages on Windows

  • Build Tools for Visual Studio 2022: These Build Tools allow you to build Visual Studio projects from a command-line interface.
  • gow: Unix command line utilities installer for Windows.
  • cht.exe: cht.sh libcurl client for Windows.
  • npiperelay: Access Windows named pipes from WSL.
  • scoop: A command-line installer for Windows.
  • starship: A cross-shell prompt.
  • winget: Windows Package Manager CLI.

Powershell Modules

  • DirColors: Provides dircolors-like functionality to all System.IO.FilesystemInfo formatters.
  • Recycle: Deletes the file or folder as if it had been done via File Explorer, or restores a deleted file from the recycle bin.
  • posh-alias: A better alias for Powershell.

Installed GUI Software (MacOS & Windows Only)

GUI Software on Windows and macOS

GUI Software on macOS (Pre-Sonoma Only)

  • Aerial: A macOS screensaver that lets you play videos from Apple's tvOS screensaver.

GUI Software on macOS

Fonts
QuickLook Plugins
  • Apparency: Preview the contents of a macOS app
  • BetterZip: A trialware file archiver. I only install this for the QuickLook plugin.
  • QLColorCode: A Quick Look plug-in that renders source code with syntax highlighting
  • qlImageSize: Display image size and resolution
  • QLMarkDown: Preview Markdown files
  • QLPrettyPatch: QuickLook generator for patch files
  • QLStephen: Preview plain text files without or with unknown file extension. Example: README, CHANGELOG, index.styl, etc
  • QLVideo: Preview most types of video files, as well as their thumbnails, cover art and metadata
  • quicklook-csv: A QuickLook plugin for CSV files
  • QuickLookJSON: A useful quick look plugin to preview JSON files
  • QuickLookASE: Preview Adobe ASE Color Swatches generated with Adobe Photoshop, Adobe Illustrator, Adobe Color CC, Spectrum, COLOURlovers, Prisma, among many others
  • Suspicious Package: Preview the contents of a standard Apple installer package
  • WebPQuickLook

GUI Software on Windows

Apps I install on an as-needed basis

As needed CLI Packages

  • asciinema]: Recording terminal sessions and sharing them on the web. Available via brew, nix, and python.
  • broot: A new way to see and navigate directory trees. Available via brew, nix, scoop, and cargo.
  • chars. Tool to display names and codes for unicode codepoints. Available via brew, nix, and cargo.
  • csview: 📠 Pretty and fast csv viewer for cli with cjk/emoji support. Available via brew, nix, scoop, and cargo.
  • csvkit: A suite of utilities for converting to and working with CSV. Available via brew, nix, and python.
  • dasel: Select, put and delete data from JSON, TOML, YAML, XML and CSV files with a single tool. Available via brew, nix, scoop, and go.
  • dirdiff: Efficiently compute the differences between two directories. Available via cargo as dirdiff-ocamlpro.
  • dog: A command-line DNS client. Available via brew as dog, nix as dogdns, and cargo from the source.
  • eva: A simple calculator REPL, similar to bc. Available via brew, nix, and cargo.
  • fast: Minimal zero-dependency utility for testing your internet download speed from terminal. Available via nix as fast-cli and go.
  • fclones: Finds and removes duplicate files. Available via brew, nix, and cargo.
  • ffmpeg: A complete, cross-platform solution to record, convert and stream audio and video. Available via brew, nix, and scoop.
  • flint: Check your project for common sources of contributor friction. Available via brew as flint-checker and go.
  • git-filter-repo: Quickly rewrite git repository history (filter-branch replacement).
  • hexyl: A simple hex viewer for the terminal. Available via brew, nix, and cargo.
  • htop: An interactive process viewer. Available via brew and nix.
  • httpie: A command-line HTTP client. Available via brew, nix, and python.
  • huniq: Command line utility to remove duplicates from the given input. Available via nix and cargo. Uses less memory than awk/uniq-seen. Rarely needed.
  • hyperfine: A command-line benchmarking tool. Available via brew, nix, and cargo.
  • petname: Generate human readable random names. Available via pypi and cargo.
  • procs: A modern replacement for ps written in Rust. Available via brew, nix, scoop, and cargo.
  • pup: A command line tool for processing HTML. Available via brew, nix, and go.
  • titlecase: A small tool that capitalizes English text. Available via cargo.
  • vivid: A generator for the LS_COLORS environment variable. Available via brew, nix, and cargo.
  • youtube-dl: Video downloading. Available via brew, nix, and python.

On my NAS, to download what I own

  • lgogdownloader: Unofficial downloader for GOG.com. Available via brew and nix.

To deal with icons and images

  • icoutils: A set of command-line programs for extracting and converting images in Microsoft Windows(R) icon and cursor files. Available via brew and nix.
  • imagemagick: Create, edit, compose, or convert digital images. Available via brew, nix, and scoop.

For beets

  • mp3val: A small, high-speed, free software tool for checking MPEG audio files' integrity. Available via brew and nix. Also available as direct binary download for Windows.
  • par2cmdline: Available via brew as par2, nix, and scoop.

As Needed CLI Packages for macOS

  • makeicns: Create icns files from the command line. Available via brew.
  • terminal-notifier: A command-line tool to send macOS User Notifications. Available via brew and nix.

As Needed GUI Software

  • Battle.net: Blizzard games client. Available via brew as battle-net.
  • MusicBrainz Picard: A cross-platform music tagger. Available via brew as musicbrainz-picard, nix as picard, Microsoft Store, winget as MusicBrainz.Picard, and scoop as picard.
  • Steam: A digital distribution platform. Available via brew, nix, and winget as Valve.Steam.
  • Tor Browser: Browser with a focus on anonymity using the Tor Network. Available via brew as tor-browser, nix as tor-browser-bundle-bin, and winget as TorProject.TorBrowser.

As Needed GUI Software for macOS

  • Adapter: Convert Video, Audio and Images. Available via brew as adapter.
  • Gemini 2: The intelligent duplicate file finder. Available via brew as gemini.
  • Numbers: Create impressive spreadsheets. Available via Mac App Store.
  • Pages: Documents that stand apart. Available via Mac App Store.
  • PhotoSweeper: A fast & powerful duplicate photos cleaner for Mac. Available via brew as photosweeper-x.
  • Pixelmator: Powerful, full-featured image editor for Mac. Available via Mac App Store.
  • SwiftBar]: Powerful macOS menu bar customization tool.
  • Wineskin: A user-friendly tool used to make ports of Microsoft Windows software to macOS. Available via brew as gcenx/wine/unofficial-wineskin.

As Needed GUI Software for Windows (All but BCU are available via winget)

Implementation Notes

  • Chezmoi is used to apply my dotfiles changes.
  • A script is run by chezmoi which applies my nix home-manager configuration, if nix is installed.
  • .config/git/config is not my main configuration, but is instead a small file which includes my main configuration. This allows for automatic git configuration changes such as vscode's change to credential.manager to be obeyed without it altering my stored git configuration. The downside to this is that these changes will not be highly visible. I may change this back, or keep the including file but track it so the changes are visible.

Reference

Chezmoi Usage

Supported Platforms

  • Linux. Tested on Arch, Ubuntu, and Debian.
  • MacOS.
  • FreeBSD.
  • Windows.

Help

Questions and comments are always welcome, please open an issue.

Contributing

Contributions of all kinds, including feedback, are always welcome!

See CONTRIBUTING.md for ways to get started.

Please adhere to this project's Code of Conduct and follow The Ethical Source Principles.

License

Distributed under the terms of the Blue Oak Model License 1.0.0 license.

See Also

Superseded Projects

Partially Superseded Projects

About

Prototype dotfiles rework using chezmoi

License:Other


Languages

Language:Shell 81.9%Language:PowerShell 15.5%Language:Dockerfile 1.0%Language:Ruby 0.9%Language:Jsonnet 0.6%Language:Python 0.1%