aalbaali / workstation_setup

Scripts to setup a (linux) workstation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Workstation setup

This repo contains script to setup a Linux workstation. Some configs (e.g., the gdb config) assume this repo is cloned in ~/.dot. Thus, the repo can be cloned using To do so, run

git clone git@github.com:aalbaali/workstation_setup.git ~/.dot

Running the installation

Quick bootstrap

# Install minimum requirements
sudo apt-get update
sudo apt-get install -y curl ca-certificates git
curl -sS https://raw.githubusercontent.com/aalbaali/workstation_setup/master/clone_and_run_dev_playbook | bash -

Default installations

The install scripts can be activated using a Makefile. The default scripts are

To run the default scripts, run

make

Installing specific Make objects

The other installations can be activated by running

make vscode
make latex_classes

Bypassing prompts

There are some prompts for some installations. To bypass these prompts, run the command

yes "" | make

Post-processing scripts

Package-specific config files are stored under the stow directory. These config files can be linked to the home directory using stow. The config files can be set up using the post_install_setup.sh. The takes multiple arguments based on the config files to link (using stow). Furthermore, the script can set up some packages (e.g., neovim plugins installations).

For example, running (from the root of this repo)

./scripts/post_install_setup.sh --zsh --functions --git --nvim --clang_format --gdb --nvim-setup

will install the config files for zsh, git, neovim, clang-format, gdb debugginer, and install the packages for neovim.

Tilix

Install tilix by running

sudo apt-get install tilix

Ensure that the Windowing system is set to X11; Wayland option will have issues with Quake.

  • To check the windowing system, check the About section in Settings, or run echo $XDG_SESSION_TYPE.
  • To set X11, uncomment the WaylandEnable=false line in /etc/gdm3/custom.conf. The changes may not take place until a restart or re-login takes place.

Configuring tilix

Open tilix (by searching for the app) and then open the user preferences

  • Appearance
    • Window style : set to Borderless
    • Uncheck the Show the terminal title even if it's the only terminal
    • Set font to a nerd font (make sure to install the font first by running the installation script)
  • Quake
    • Adjusut height percentage (I have mine set at 70%)
    • Adjust width percentage (I have mine set at 75%)

To run quake from anywhere in Linux, add a keyboard shortcut in the shortcuts settings. I have mine set to Super + -, which calls the command tilix --quake

To run tilix using the ctrl + alt + T shortcut, disable the terminal's shortcut and enable a tilix shortcut.

Sioyek

To make Sioyek the default PDF viewer, the sioyek.desktop needs to be installed. This is done as follows:

  1. Link sioyek.desktop from stow/sioyek/.local/share/applications/sioyek.desktop into ~/.local/share/application
  2. Link sioyek-icon-linux.png from stow/sioyek/.local/share/Sioyek/sioyek-icon-linux.png into ~/.local/share/Sioyek
  3. Install the application by running sudo desktop-file-install sioyek.desktop from ~/.local/share/application

Ubuntu

Dock settings

The auto-dock can be customized so that it doesn't pop up when switching applications using shortcuts. To configure the autodock, an editor is to be installed.

sudo apt install dconf-editor

Once installed, launch the dconf Editor application and go to /org/gnome/shell/extensions/dash-to-dock/hot-keys and turn off the hotkeys-overlay and hotkeys-show-dock options. Also, set /org/gnome/shell/extensions/dash-to-dock/shortcut-timeout timeout value to 0 (you need to turn off Use default value, and set the Custom value to 0).

To load dconf settings, run

dconf load / < dconf-settings.ini

Borderless windows

sudo apt install gnome-tweaks

Node

To install different versions of NodeJS, you can use the n npm package.

# Make sure npm is installed
sudo apt-get install npm

# Install n manager
sudo npm install -g n

# Install latest node version
sudo n latest

# Or, install specific version
# sudo n 16.20

Alternatively, use the node version manager nvm:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
source ~/.zshrc # Or source ~/.bashrc
nvm install 16.20

FAQs and common issues

Neovim's coc-ccls may give an error of unable to load global extension.

The error can be resolved by running

cd ~/.config/coc/extensions/node_modules/coc-ccls
ln -s node_modules/ws/lib lib

This snippet is executed in the post_install_setup.sh script when passing the --nvim-setup flag. Note that this script will only work after installing the coc-ccls plugin first (i.e., it sufficies to launch nvim before launching the script).

ZSH fonts

Additional packages may be required for the ZSH font to be displayed correctly. Check the spaceship-prompt and this answer.

Docker detach bindings

Docker has detach binding set to ctrl+p by default. This causes issues while inside a container such as accessing the previous command. To fix this issue, change the default Docker detach binding by modifying ~/.docker/config.json to be

{
    "detachKeys": "ctrl-z,z"
}

Quick bluetooth connections

I use a Keychron K2 keyboard, which supports bluetooth connection. When the computer goes to sleep, the keyboard disconnects. However, reconnecting to the computer after waking it up takes quite some time. To fix this, make the following changes inside sudo vim /etc/bluetooth/main.conf:

# Uncomment the following lines
FastConnectable = false
ReconnectIntervals=1, 2, 4, 8, 16, 32, 64
AutoEnable=true

Neovim's Mason causing installation issues

Sometimes, Mason encounters issues while installing some packages. For example,

.../start/mason.nvim/lua/mason-core/installer/init.lua:61: Lockfile already exists. Package(name=lua-language-server)

This is usually caused by a lock by npm to prevent multiple installs. Here are some checks to remove this error:

  1. check any running npm installations, and either wait for them to finish or kill them;
  2. if there are no installations are running, then it's possible that the lock file is stale and didn't update. To remove the lock, delete the files in ~/.local/share/nvim/mason/staging

Zsh autocompletion is acting funny

Sometimes the autocompletion tends to act funny. One of the reasons I found was happening when loading starship. Specifically, when I commented out the eval "$(starship init zsh)" line from ~/.zshrc, the issue would disappear. The solution was to install locale and set the region and language settings. The following are the debugging and solution steps:

  1. To ensure that the issue is a locale issue, then if you try to paste the character in the terminal would not paste properly
  2. Solution:
sudo apt-get install locales

# Ensure the following env vars are stored in ~/.zshrc
export LANG=en_US.UTF-8
export LANGUAGE=en_US:en
export LC_ALL=en_US.UTF-8

Resources

About

Scripts to setup a (linux) workstation


Languages

Language:GDB 32.1%Language:Shell 31.5%Language:Lua 29.7%Language:Python 4.8%Language:Vim Script 1.5%Language:Makefile 0.4%Language:Perl 0.1%