felipecrs/dotfiles

repository·master·Indexed 19 days ago

https://github.com/felipecrs/dotfiles

A collection of dotfiles and automation scripts to bootstrap Ubuntu environments (WSL, Server, Desktop) with a customized ZSH setup using Powerlevel10k. Includes utilities such as a VS Code CLI wrapper with Dev Container support, a full system upgrade script for multiple package managers, a Gerrit repository cloning tool with hook installation, a Homebrew version installer, and the kpfd utility for Kubernetes port-forwarding in Docker.

Tokens
5.2K
Snippets
17
Records
23
Agent score
64%

What's inside felipecrs-dotfiles

  1. Use Minimum Mode for non-Ubuntu distributions

    master

    If you are using a distribution other than Ubuntu (e.g., in a Dev Container or Home Assistant VS Code Add-on), you can use Minimum Mode.

    Minimum mode only installs the dotfiles required for the command prompt, ensuring compatibility with a wider range of Linux distributions. The installation script will prompt you to enable this mode, and it is enabled by default when running in environments like Dev Containers.

  2. Install the dotfiles using the convenience script

    master

    You can bootstrap your Ubuntu environment (WSL, Server, or Desktop) using a single command. This script automates the installation process.

    Using wget:

    sh -c "$(wget -qO- https://git.io/felipecrs-dotfiles)"

    Using curl:

    sh -c "$(curl -fsSL https://git.io/felipecrs-dotfiles)"
  3. Run extra automation scripts directly

    master

    You can run individual automation scripts from the repository without performing a full installation by using curl to pipe the script to bash. Pass arguments after a -- separator.

    Pattern:

    bash -c "$(curl -fsSL "https://raw.githubusercontent.com/felipecrs/dotfiles/master/scripts/<script-name>")" -- <arguments>

    Example: Running the Chrome shortcut script with a flag

    bash -c "$(curl -fsSL "https://raw.githubusercontent.com/felipecrs/dotfiles/master/scripts/create_alternative_chrome_shortcut.sh")" -- --force
  4. Install the dotfiles manually without the convenience script

    master

    If you prefer not to use the one-liner script, you can clone the repository and run the installer locally:

    git clone https://github.com/felipecrs/dotfiles "$HOME/.dotfiles"
    
    "$HOME/.dotfiles/install.sh"
  5. Configure the terminal font for Powerlevel10k

    master

    The dotfiles use the Powerlevel10k ZSH theme, which requires a Nerd Font to display glyphs correctly. It is recommended to use FiraCode Nerd Font Mono.

    While the installer handles this automatically for WSL/Ubuntu Desktop, you must configure it manually on other systems:

    1. Install the font on Windows

    1. Download FiraCodeNerdFontMono-Regular.ttf.
    2. Open the file and click Install.
    3. Restart your applications.

    2. Configure VS Code

    1. Open Settings (Ctrl+,).
    2. Search for Terminal › Integrated: Font Family.
    3. Set the value to FiraCode Nerd Font Mono.

    3. Configure Windows Terminal

    1. Open Settings (Ctrl+,).
    2. Navigate to Profiles -> Defaults -> Additional settings -> Appearance.
    3. Under Text -> Font face, select FiraCode Nerd Font Mono.
  6. Run Git Credential Manager in WSL

    master

    When using WSL (Windows Subsystem for Linux), you can execute the Windows version of Git Credential Manager by using a wrapper script that exports necessary environment variables. This ensures that GIT_EXEC_PATH is correctly shared between the Linux and Windows environments, resolving issues identified in GCM issue #376.

    The wrapper performs the following steps:

    1. Determines the current Git exec path via git --exec-path.
    2. Exports GIT_EXEC_PATH.
    3. Appends GIT_EXEC_PATH/wp to WSLENV to allow the variable to be shared with Windows processes.
    4. Executes the Windows binary located at /usr/local/share/gcm/git-credential-manager.exe with all passed arguments (${@}).
    #!/usr/bin/env bash
    
    set -eu
    
    # Logic for WSL environments
    GIT_EXEC_PATH="$(git --exec-path)"
    export GIT_EXEC_PATH
    export WSLENV="${WSLENV}:GIT_EXEC_PATH/wp"
    
    # Execute the Windows binary
    exec /usr/local/share/gcm/git-credential-manager.exe "${@}"
  7. Configure VS Code behavior via environment variables

    master

    You can control the logic of the code wrapper using the following environment variables:

    VariableTypeDescription
    CODE_NATIVEbooleanIf set to 1 (or any non-empty value), the script disables remote session detection and fallback logic, forcing it to use the local code binary.
    DEBUGbooleanIf set, enables shell trace (set -x) for debugging the script execution.
    ssh_hoststringUsed to specify an SSH host for remote connection logic.
    VSCODE_IPC_HOOK_CLIstringPath to a VS Code IPC socket; used to connect to existing remote sessions.
  8. Configure gerrit-clone with a default base URL

    master

    To enable cloning via project name only, create a JSON configuration file at ~/.gerrit-clonerc.json. The file must contain a defaultBaseUrl key representing the base URL of your Gerrit server (including the optional a/ auth endpoint if required).

    Example ~/.gerrit-clonerc.json:

    {
        "defaultBaseUrl": "https://review.gerrithub.io/a/"
    }
  9. Customize the installation with environment variables

    master

    The convenience script supports environment variables to control which repository and branch are used during installation.

    Supported Variables:

    • DOTFILES_REPO_HOST: The host for the repository (defaults to https://github.com).
    • DOTFILES_USER: The GitHub username (defaults to felipecrs).
    • DOTFILES_BRANCH: The branch to install (defaults to master).

    Example: Installing a specific branch

    DOTFILES_BRANCH=beta sh -c "$(wget -qO- https://git.io/felipecrs-dotfiles)"
  10. gerrit-clone CLI usage and arguments

    master

    The gerrit-clone command follows this syntax:

    gerrit-clone [--help] <repository> [<directory>] [<additional-git-clone-args>]

    Arguments

    • <repository>: The target repository. This can be a full http/https URL or a project name (if configured).
    • [<directory>]: (Optional) The local directory where the repository should be cloned. If omitted, the basename of the repository is used.
    • [<additional-git-clone-args>]: (Optional) Any additional flags passed directly to the underlying git clone command (e.g., --depth=1).

    Flags

    • --help: Displays the help text and usage examples.
    # Usage pattern
    gerrit-clone <repository> [<directory>] [<additional-git-clone-args>]
  11. Reference: Supported package managers and tools in executable_full-upgrade

    master

    The executable_full-upgrade script targets the following tools for updates. If a tool is not found in the system path, that specific update step is skipped.

    ### Package Managers & System Tools
    - **Homebrew**: `brew update` and `brew upgrade` (with `HOMEBREW_NO_AUTO_UPDATE=1` to prevent redundant updates).
    - **chezmoi**: `chezmoi update --apply=false`, `chezmoi init --force`, and `chezmoi apply --force`.
    - **pkgx**: `pkgs install` for existing packages and `pkgx <packages>` for cached packages.
    - **apt**: `sudo apt update`, `sudo apt full-upgrade --yes`, and `sudo apt autoremove --yes`.
    - **snap**: `sudo snap refresh`.
    - **flatpak**: `flatpak update --user --assumeyes` and `sudo flatpak update --system --assumeyes`.
    - **gext**: `gext update --yes --user` (GNOME extensions).
    - **pipx**: `pipx upgrade-all`.
    - **Volta**: `volta install node npm yarn pnpm`.
    - **npm**: `npm update --global`.
    
    ### Windows/WSL Specific Tools
    - **VS Code**: `winget.exe upgrade --exact --id Microsoft.VisualStudioCode --source winget --accept-source-agreements --disable-interactivity`.
    - **Windows Terminal**: `winget.exe upgrade --exact --id Microsoft.WindowsTerminal --source winget --accept-source-agreements --disable-interactivity`.
    - **WSL**: `wsl.exe --update`
  12. Use create_alternative_chrome_shortcut.sh to create Chrome profiles

    master

    This script creates a new Google Chrome shortcut that uses a different user data directory, allowing you to run multiple instances of Chrome with different icons and settings.

    Usage:

    scripts/create_alternative_chrome_shortcut.sh [-f|--(no-)force] [-h|--help] [<display-name>]

    Arguments:

    • <display-name>: The name displayed in the app launcher (defaults to 'Alternative').
    • -f, --force: Do not ask for confirmation (off by default).
    • -h, --help: Prints help.

    Example:

    scripts/create_alternative_chrome_shortcut.sh Personal