Skip to content

dimanu-py/dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚙️ Dotfiles ⚙️

This guide of how to use Stow to track configuration file was extracted from Dream of Autonomy video and Stow documentation. The links to both resources can be found in the links bellow.

Original video GNU Stow Docs


  1. Install GNU Stow
  2. Keep track of your configuration
    1. Folder structure
    2. Track single files
    3. Track folders
    4. Pushing to remote repo

Installing GNU Stow

Note

GNU Stow is a symlink farm manager which takes distinct packages of software and/or data located in separated directories on the file system and makes them appear to be installed in the sample place through symlinks

Install stow package

pacman -Ss stow
sudo pacman -S stow

Keep track of your configuration

Folder structure

We first have to create a folder in the home directory to store your configurations:

mkdir ~/dotfiles && cd dotfiles

Important

In order to stow to work we must set this directory in the same way our .config folder is organized.

Then we can initialize a git repository inside this folder

git init .

The .git directory will be ignored automatically by Stow. To see the default files that will be ignored you can visit this webpage.

If you want to ignore custom files, you can create a .stow-local-ignore file. Doing this you will override the default ignore file and would need to specify all files you want to ignore, even if they are specified in the default file.

Track single files

To keep track of a single file we need to copy that file from our .config folder into the new dotfiles. For example:

cp ~/.zshrc . 

After copying the file we can delete it from the original folder or rename it to have it as a backup (mv ~/.zshrc ~/.zshrc.bak)

To let Stow create the symlink we just need to run the following command inside the dotfiles directory:

stow .

Tip

We can see if this has worked by listing the .zshrc file in the $HOME directory and seeing that it has a symbolic link to our file in the dotfiles directory

After verifying the changes work correctly, we can commit the files. Also, we can modify the symlinked file in our home directory and the changes will be applied at the same time to the dotfiles file.

Track folders

To keep track of a folder we need to copy it following the same format of our .config folder. If we want to copy the alacritty configuration we would run:

cd dotfiles
mkdir .config
cp -r ~/.config/alacritty/ .config

When copying folders we can encounter conflicts between the actual .config file and the one we've copied inside dotfiles.

Warning

If we try to run stow . and there are conflicts, Stow will warn us and abort the operation.

To solve this we can delete the existing directory or rename it as we did for the single file. However, the best approach here is to run:

stow --adopt .

Warning

Before running this command we should commit our dotfiles file as the --adopt option will override the dotfiles version with the .config version that is causing the conflict. By doing this, we can decide which option we want to keep with git later on.

Pushing to remote repository

To keep safe the repository you can create a remote repo in GitHub or other platform and push your dotfiles there by running:

git remote add origin <path_to_your_remote_repo>
git push origin main

About

Configuration files for ArcoLinux

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published