Skip to content

hiepph/dotfiles

Repository files navigation

dotfiles

Stow

Mainly I structure my modules follow their paths starting from $HOME. To activate the module, symlink the corresponding folder to $HOME.

This task is done by GNU Stow.

stow <module>

Not every module here can be stowed though.

Linux

Some distros I’m using for my personal machine:

  • OpenSUSE Tumbleweed

    • Rolling released.

    • System recovery and snapshot with Snapper and btrfs

    • YaST is awesome.

  • Fedora

    • Supports a wide range of hardware.

    • Bleeding edge packages.

    • btrfs is the default filesystem since Fedora 36.

  • Arch:

    • Rolling released.

    • Total control of my system. KISS (Keep It Simple, Stupid).

    • Arch’s wiki is awesome.

    • Have fun ricing my desktop.

Guix

I use Guix as my package manager, together with the official package manager (i.e. Fedora’s dnf)

  • Stow guix first.

  • To make packages update effective:

guix home reconfigure ~/.config/guix/home-configuration.scm
  • To describe generations:

guix home describe

BSD

TBD

Mac

MacPorts and Nix are used to manage packages.

MacPorts

  • Mainly used for installing the shell (Fish), text editor (Emacs) and packages which I cannot simply install with Nix.

cd macports
./install_ports.sh

Nix

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
  • Install

# with an unstable channel
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager

# with a stable channel (23.5)
nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz home-manager
nix-channel --update
nix-shell '<home-manager>' -A install
  • Shell are not managed with home-manager though, for stability reason.

  • When you need to make change to the packages, edit ~/.config/home-manager/home.nix and:

home-manager switch
  • stow is used when changes are made often: e.g. fish, vim.

  • Otherwise, some modules are managed and symlinked with home-manager. Check what modules are managed with home-manager in home-manager/home.nix:

home.file = {
  ...
}

Rollbacks

  • List generations:

home-manager generations
  • Perform the rollback:

/nix/store/...-home-manager-generation/activate

Issues

  • Broken home-manager? Update Nix’s channel to pull fixes and install home-manager again:

nix-channel --add <fixed-channel> home-manager
nix-channel --update

home-manager switch

Shell

  • My default shell is fish.

    • Pros:

      • I hate Bash arcane syntax. It’s fast to write a small script in Bash but horrible to grow into a larger script. Even Google Shell style guide recommends not to write a script more than 100 lines long.

      • Seamless interops with shell commands. It makes writing script interactively on a shell fun. One-liner manner is achievable. With a general purpose language, e.g. Python, I have to wrap shell command with os.system or subprocess.

      • References: Why fish?, Rash lang.

    • Cons:

      • It does not follow POSIX shell standards. So if I want to run a common Bash or Zsh script, better use bash script.sh.

  • To change default shell for a user:

chsh -s $(which fish)

Emacs

I decided to switch (and possibly contribute) to doom-emacs instead of writing my vanilla Emacs configurations.

I want to contribute and learn best practice from community, at least until I’m confident enough to maintain my own configurations.

My Doom Emacs’ configuration lives in emacs/.doom.d.

Issues

  • Broken icons in the modeline: M-x to install:

nerd-icon-install-fonts

Vim

  • Create custom file for each machine: ~/.custom.vim. For example:

colorscheme alduin

Python

A lot of tools are installed with Python pip. I use pyenv to manage my Python environments.

  • To configure pyenv with Fish shell:

set -Ux PYENV_ROOT $HOME/.pyenv
fish_add_path $PYENV_ROOT/bin
pyenv init - | source
  • To install and use a Python version globally:

pyenv install 3.10
pyenv global <version>

Ruby

I use rbenv to manage my Ruby environments.

  • To configure rbenv with Fish shell:

fish_add_path $HOME/.rbenv/shims
status --is-interactive; and rbenv init - fish | source
  • To install and use a Ruby version globally:

rbenv install 3.2.2
rbenv global <version>

Themes

Below is an awesome list of themes done in style. All are eye-care themes.

Mouse

Logitech MX Master 3

  • Driver on Linux: logiops

    • Key codes can be found here

  • Put the configuration in mx-master-3/<desktop>/logid.cfg at /etc/logid.cfg:

  • Start/Enable the service:

sudo systemctl enable --now logid
  • Restart the service:

sudo systemctl restart logid

Firefox

  • I follow recommendations from Betterfox

  • Note that editing about:config won’t take effect if you have user.js inside your profiles. user.js will reset all of your changes when start a new browser.

  • Mac:

ln -s $PWD/firefox/user.js "$HOME/Library/Application Support/Firefox/Profiles/"
  • Linux:

ln -s $PWD/firefox/user.js (readlink -f (ls -d $HOME/.mozilla/firefox/*.default | head -n 1))/

uBlock Origin Filter Lists

  • Go to Options > Filter Lists > Annoyances and turn on all of them. Optionally, you can turn on Cloud Storage sync (refer).

  • Some additional personal filters list:

accounts.google.com/gsi/iframe